diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-05-29 13:03:00 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-05-29 13:03:00 +0000 |
commit | 21447f3a0f099622a45d34e37a5dbe761a0ca64c (patch) | |
tree | 7dedce7e4abebe7f616d8efcd0125afd58e8daaa /cpp/src/Ice/TcpAcceptor.cpp | |
parent | Fixed bug 2213 (diff) | |
download | ice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.tar.bz2 ice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.tar.xz ice-21447f3a0f099622a45d34e37a5dbe761a0ca64c.zip |
Moved setting of SO_REUSEADDR and added comment
Diffstat (limited to 'cpp/src/Ice/TcpAcceptor.cpp')
-rw-r--r-- | cpp/src/Ice/TcpAcceptor.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp index 2ffb6fd5a0d..3d3c28b787d 100644 --- a/cpp/src/Ice/TcpAcceptor.cpp +++ b/cpp/src/Ice/TcpAcceptor.cpp @@ -121,6 +121,21 @@ IceInternal::TcpAcceptor::TcpAcceptor(const InstancePtr& instance, const string& setBlock(_fd, false); getAddress(host, port, _addr); setTcpBufSize(_fd, _instance->initializationData().properties, _logger); +#ifndef _WIN32 + // + // Enable SO_REUSEADDR on Unix platforms to allow re-using the + // socket even if it's in the TIME_WAIT state. On Windows, + // this doesn't appear to be necessary and enabling + // SO_REUSEADDR would actually not be a good thing since it + // allows a second process to bind to an address even it's + // already bound by another process. + // + // TODO: using SO_EXCLUSIVEADDRUSE on Windows would probably + // be better but it's only supported by recent Windows + // versions (XP SP2, Windows Server 2003). + // + setReuseAddress(_fd, true); +#endif if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); |