Skip to content

Commit

Permalink
Set TCP backlog default to 511, remove SOMAXCONN (#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Nov 15, 2024
1 parent aaaf89d commit abf2c53
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/PropertyNames.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<property name="Trace.ThreadPool" languages="cpp,csharp,java" default="0" />
<property name="UDP.RcvSize" languages="cpp,csharp,java" />
<property name="UDP.SndSize" languages="cpp,csharp,java" />
<property name="TCP.Backlog" languages="cpp,csharp,java" />
<property name="TCP.Backlog" languages="cpp,csharp,java" default="511" />
<property name="TCP.RcvSize" languages="cpp,csharp,java" />
<property name="TCP.SndSize" languages="cpp,csharp,java" />
<property name="UseOSLog" languages="cpp" default="0" />
Expand Down
2 changes: 1 addition & 1 deletion config/makeprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def moveFiles(self, location):
location,
"java",
"src",
"Ice",
"com.zeroc.ice",
"src",
"main",
"java",
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/PropertyNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const Property IcePropsData[] =
Property{"Trace.ThreadPool", "0", false, false, nullptr},
Property{"UDP.RcvSize", "", false, false, nullptr},
Property{"UDP.SndSize", "", false, false, nullptr},
Property{"TCP.Backlog", "", false, false, nullptr},
Property{"TCP.Backlog", "511", false, false, nullptr},
Property{"TCP.RcvSize", "", false, false, nullptr},
Property{"TCP.SndSize", "", false, false, nullptr},
Property{"UseOSLog", "0", false, false, nullptr},
Expand Down
9 changes: 1 addition & 8 deletions cpp/src/Ice/TcpAcceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
# include <Mswsock.h>
# endif

//
// Use the system default for the listen() backlog or 511 if not defined.
//
# ifndef SOMAXCONN
# define SOMAXCONN 511
# endif

using namespace std;
using namespace Ice;
using namespace IceInternal;
Expand Down Expand Up @@ -198,7 +191,7 @@ IceInternal::TcpAcceptor::TcpAcceptor(
_info(SocketOperationRead)
# endif
{
_backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN);
_backlog = instance->properties()->getIcePropertyAsInt("Ice.TCP.Backlog");
_fd = createServerSocket(false, _addr, instance->protocolSupport());

# ifdef ICE_USE_IOCP
Expand Down
6 changes: 1 addition & 5 deletions cpp/src/Ice/ios/StreamAcceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ IceObjC::StreamAcceptor::StreamAcceptor(
_instance(instance),
_addr(getAddressForServer(host, port, instance->protocolSupport(), instance->preferIPv6(), true))
{
# ifdef SOMAXCONN
_backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN);
# else
_backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
# endif
_backlog = instance->properties()->getIcePropertyAsInt("Ice.TCP.Backlog");

try
{
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Ice/Internal/PropertyNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ internal sealed class PropertyNames
new(pattern: @"Trace.ThreadPool", usesRegex: false, defaultValue: "0", deprecated: false, propertyArray: null),
new(pattern: @"UDP.RcvSize", usesRegex: false, defaultValue: "", deprecated: false, propertyArray: null),
new(pattern: @"UDP.SndSize", usesRegex: false, defaultValue: "", deprecated: false, propertyArray: null),
new(pattern: @"TCP.Backlog", usesRegex: false, defaultValue: "", deprecated: false, propertyArray: null),
new(pattern: @"TCP.Backlog", usesRegex: false, defaultValue: "511", deprecated: false, propertyArray: null),
new(pattern: @"TCP.RcvSize", usesRegex: false, defaultValue: "", deprecated: false, propertyArray: null),
new(pattern: @"TCP.SndSize", usesRegex: false, defaultValue: "", deprecated: false, propertyArray: null),
new(pattern: @"Warn.AMICallback", usesRegex: false, defaultValue: "1", deprecated: false, propertyArray: null),
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Ice/Internal/TcpAcceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal TcpAcceptor(TcpEndpointI endpoint, ProtocolInstance instance, string ho
{
_endpoint = endpoint;
_instance = instance;
_backlog = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
_backlog = instance.properties().getIcePropertyAsInt("Ice.TCP.Backlog");

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ final class PropertyNames
new Property("Trace.ThreadPool", false, "0", false, null),
new Property("UDP.RcvSize", false, "", false, null),
new Property("UDP.SndSize", false, "", false, null),
new Property("TCP.Backlog", false, "", false, null),
new Property("TCP.Backlog", false, "511", false, null),
new Property("TCP.RcvSize", false, "", false, null),
new Property("TCP.SndSize", false, "", false, null),
new Property("UseSyslog", false, "0", false, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int effectivePort() {
TcpAcceptor(TcpEndpointI endpoint, ProtocolInstance instance, String host, int port) {
_endpoint = endpoint;
_instance = instance;
_backlog = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
_backlog = instance.properties().getIcePropertyAsInt("Ice.TCP.Backlog");

try {
_fd = Network.createTcpServerSocket();
Expand Down

0 comments on commit abf2c53

Please sign in to comment.