Arquivos
hhvm/hphp/runtime/server/fastcgi/fastcgi-server-factory.cpp
T
Erik b538a34e89 Support for UNIX sockets
Add a new config param, Server.FileSocket. When
Server.FileSocket
is set it will be used inplace of a network socket for the primary
server. This uses a new parameter to ServerOptions, m_useFileSocket,
to toggle between treating the address as a socket path or a network
address.

To initialize a socket connection thrift expects the socket file to not
exist. To support this the 'something nice' retry in startServer will
unlink an existing socket only if fuser claims it is unused.
Server.EvilShutdown enables unlinking the socket regardless of current
users.

Closes #1594

Reviewed By: @ptarjan

Differential Revision: D1135876

Pulled By: @sgolemon
2014-01-28 15:38:35 -08:00

49 linhas
1.8 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "hphp/runtime/server/fastcgi/fastcgi-server.h"
namespace HPHP {
class FastCGIServerFactory : public ServerFactory {
public:
FastCGIServerFactory() {}
virtual ServerPtr createServer(const ServerOptions& options) override {
return std::make_shared<FastCGIServer>(options.m_address,
options.m_port,
options.m_numThreads,
options.m_useFileSocket);
}
};
}
extern "C" {
/*
* Automatically register FastCGIServerFactory on program start
*/
void register_fastcgi_server() __attribute__((constructor));
void register_fastcgi_server() {
auto registry = HPHP::ServerFactoryRegistry::getInstance();
auto factory = std::make_shared<HPHP::FastCGIServerFactory>();
registry->registerFactory("fastcgi", factory);
}
}