summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/winrt
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2014-08-08 13:33:18 -0230
committerDwayne Boone <dwayne@zeroc.com>2014-08-08 13:33:18 -0230
commitc540f34ba2dd245e88cee99f39552efbd44c91e1 (patch)
treea637ce6dce7ad189069e784f21d5166c6a98aff1 /cpp/src/Ice/winrt
parentFixed (ICE-5583) - Consider adding IceSSL.CertAuthFile to C# implementation (diff)
downloadice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.bz2
ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.xz
ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.zip
ICE-5596 add Ice.Default.Timeout property
Diffstat (limited to 'cpp/src/Ice/winrt')
-rw-r--r--cpp/src/Ice/winrt/StreamEndpointI.cpp37
-rw-r--r--cpp/src/Ice/winrt/StreamEndpointI.h1
2 files changed, 31 insertions, 7 deletions
diff --git a/cpp/src/Ice/winrt/StreamEndpointI.cpp b/cpp/src/Ice/winrt/StreamEndpointI.cpp
index b58f9e826ce..5bb59dea33b 100644
--- a/cpp/src/Ice/winrt/StreamEndpointI.cpp
+++ b/cpp/src/Ice/winrt/StreamEndpointI.cpp
@@ -72,7 +72,7 @@ IceInternal::StreamEndpointI::StreamEndpointI(const ProtocolInstancePtr& instanc
IceInternal::StreamEndpointI::StreamEndpointI(const ProtocolInstancePtr& instance) :
IPEndpointI(instance),
- _timeout(-1),
+ _timeout(-2),
_compress(false)
{
}
@@ -193,7 +193,11 @@ IceInternal::StreamEndpointI::options() const
s << IPEndpointI::options();
- if(_timeout != -1)
+ if(_timeout == -1)
+ {
+ s << " -t infinite";
+ }
+ else
{
s << " -t " << _timeout;
}
@@ -294,6 +298,17 @@ IceInternal::StreamEndpointI::hashInit(Ice::Int& h) const
hashAdd(h, _compress);
}
+void
+IceInternal::StreamEndpointI::initWithOptions(vector<string>& args, bool oaEndpoint)
+{
+ IPEndpointI::initWithOptions(args, oaEndpoint);
+
+ if(_timeout == -2)
+ {
+ const_cast<Int&>(_timeout) = _instance->defaultTimeout();
+ }
+}
+
bool
IceInternal::StreamEndpointI::checkOption(const string& option, const string& argument, const string& endpoint)
{
@@ -312,12 +327,20 @@ IceInternal::StreamEndpointI::checkOption(const string& option, const string& ar
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")
{
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint;
- throw ex;
+ const_cast<Int&>(_timeout) = -1;
+ }
+ else
+ {
+ 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;
}
diff --git a/cpp/src/Ice/winrt/StreamEndpointI.h b/cpp/src/Ice/winrt/StreamEndpointI.h
index 59ebc442417..58de59fd410 100644
--- a/cpp/src/Ice/winrt/StreamEndpointI.h
+++ b/cpp/src/Ice/winrt/StreamEndpointI.h
@@ -49,6 +49,7 @@ protected:
virtual void streamWriteImpl(BasicStream*) const;
virtual void hashInit(Ice::Int&) const;
+ virtual void initWithOptions(std::vector<std::string>&, bool);
virtual bool checkOption(const std::string&, const std::string&, const std::string&);
virtual ConnectorPtr createConnector(const Address&, const NetworkProxyPtr&) const;