diff -Nur omniORB-4.1.7/include/omniORB4/internal/orbParameters.h omniORB-4.1.7.patched/include/omniORB4/internal/orbParameters.h --- omniORB-4.1.7/include/omniORB4/internal/orbParameters.h 2009-05-06 18:16:18.000000000 +0200 +++ omniORB-4.1.7.patched/include/omniORB4/internal/orbParameters.h 2014-01-20 10:30:48.505009492 +0100 @@ -539,6 +539,9 @@ // handled; otherwise, they are not watched until the // SocketCollection next scans the connection list. +_CORBA_MODULE_VAR _core_attr CORBA::ULong listenBacklog; +// Allows setting of listen backlog size. The default value is SOMAXCONN. + _CORBA_MODULE_END OMNI_NAMESPACE_END(omni) diff -Nur omniORB-4.1.7/src/lib/omniORB/orbcore/giopServer.cc omniORB-4.1.7.patched/src/lib/omniORB/orbcore/giopServer.cc --- omniORB-4.1.7/src/lib/omniORB/orbcore/giopServer.cc 2009-05-06 18:16:18.000000000 +0200 +++ omniORB-4.1.7.patched/src/lib/omniORB/orbcore/giopServer.cc 2014-01-20 10:31:29.642615616 +0100 @@ -165,6 +165,7 @@ #include #include #include +#include #include #include @@ -239,6 +240,8 @@ // Note that this setting has no effect on Windows, since it has no // mechanism for signalling the connection watching thread. +CORBA::ULong orbParameters::listenBacklog = SOMAXCONN; +// A high rate of incoming connections may require a longer listen backlog. //////////////////////////////////////////////////////////////////////////// static const char* plural(CORBA::ULong val) @@ -1683,8 +1686,33 @@ static connectionWatchImmediateHandler connectionWatchImmediateHandler_; +///////////////////////////////////////////////////////////////////////////// +class listenBacklogHandler : public orbOptions::Handler { +public: + listenBacklogHandler() : + orbOptions::Handler("listenBacklog", + "listenBacklog = n >= 1", + 1, + "-ORBlistenBacklog < n >= 1 >") {} + + void visit(const char* value,orbOptions::Source) throw (orbOptions::BadParam) { + + CORBA::ULong v; + if (!orbOptions::getULong(value,v) || v < 1) { + throw orbOptions::BadParam(key(),value, + orbOptions::expect_greater_than_zero_ulong_msg); + } + orbParameters::listenBacklog = v; + } + + void dump(orbOptions::sequenceString& result) { + orbOptions::addKVULong(key(),orbParameters::listenBacklog, + result); + } +}; +static listenBacklogHandler listenBacklogHandler_; ///////////////////////////////////////////////////////////////////////////// // Module initialiser // @@ -1701,6 +1729,7 @@ orbOptions::singleton().registerHandler(maxServerThreadPoolSizeHandler_); orbOptions::singleton().registerHandler(threadPoolWatchConnectionHandler_); orbOptions::singleton().registerHandler(connectionWatchImmediateHandler_); + orbOptions::singleton().registerHandler(listenBacklogHandler_); } void attach() { diff -Nur omniORB-4.1.7/src/lib/omniORB/orbcore/ssl/sslEndpoint.cc omniORB-4.1.7.patched/src/lib/omniORB/orbcore/ssl/sslEndpoint.cc --- omniORB-4.1.7/src/lib/omniORB/orbcore/ssl/sslEndpoint.cc 2013-04-10 19:14:44.000000000 +0200 +++ omniORB-4.1.7.patched/src/lib/omniORB/orbcore/ssl/sslEndpoint.cc 2014-01-20 10:22:26.837077171 +0100 @@ -538,7 +538,7 @@ return 0; } - if (listen(pd_socket,SOMAXCONN) == RC_SOCKET_ERROR) { + if (listen(pd_socket,orbParameters::listenBacklog) == RC_SOCKET_ERROR) { CLOSESOCKET(pd_socket); omniORB::logs(1, "Failed to listen on socket."); return 0; diff -Nur omniORB-4.1.7/src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc omniORB-4.1.7.patched/src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc --- omniORB-4.1.7/src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc 2013-04-10 19:14:44.000000000 +0200 +++ omniORB-4.1.7.patched/src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc 2014-01-20 10:22:43.953958115 +0100 @@ -522,7 +522,7 @@ return 0; } - if (listen(pd_socket,SOMAXCONN) == RC_SOCKET_ERROR) { + if (listen(pd_socket,orbParameters::listenBacklog) == RC_SOCKET_ERROR) { CLOSESOCKET(pd_socket); omniORB::logs(1, "Failed to listen on socket."); return 0;