diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
commit | c540f34ba2dd245e88cee99f39552efbd44c91e1 (patch) | |
tree | a637ce6dce7ad189069e784f21d5166c6a98aff1 /cpp/src/Ice/TcpEndpointI.cpp | |
parent | Fixed (ICE-5583) - Consider adding IceSSL.CertAuthFile to C# implementation (diff) | |
download | ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.bz2 ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.xz ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.zip |
ICE-5596 add Ice.Default.Timeout property
Diffstat (limited to 'cpp/src/Ice/TcpEndpointI.cpp')
-rw-r--r-- | cpp/src/Ice/TcpEndpointI.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 7d593d6203a..a47c956c6c2 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -32,7 +32,7 @@ IceInternal::TcpEndpointI::TcpEndpointI(const ProtocolInstancePtr& instance, con IceInternal::TcpEndpointI::TcpEndpointI(const ProtocolInstancePtr& instance) : IPEndpointI(instance), - _timeout(-1), + _timeout(-2), _compress(false) { } @@ -164,7 +164,11 @@ IceInternal::TcpEndpointI::options() const s << IPEndpointI::options(); - if(_timeout != -1) + if(_timeout == -1) + { + s << " -t infinite"; + } + else { s << " -t " << _timeout; } @@ -277,6 +281,17 @@ IceInternal::TcpEndpointI::fillEndpointInfo(IPEndpointInfo* info) const } } +void +IceInternal::TcpEndpointI::initWithOptions(vector<string>& args, bool oaEndpoint) +{ + IPEndpointI::initWithOptions(args, oaEndpoint); + + if(_timeout == -2) + { + const_cast<Int&>(_timeout) = _instance->defaultTimeout(); + } +} + bool IceInternal::TcpEndpointI::checkOption(const string& option, const string& argument, const string& endpoint) { @@ -295,12 +310,20 @@ IceInternal::TcpEndpointI::checkOption(const string& option, const string& argum ex.str = "no argument provided for -t option in endpoint " + endpoint; throw ex; } - istringstream t(argument); - if(!(t >> const_cast<Int&>(_timeout)) || !t.eof()) + + if(argument == "infinite") + { + const_cast<Int&>(_timeout) = -1; + } + else { - EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; - throw ex; + istringstream t(argument); + if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; + throw ex; + } } return true; } |