diff options
Diffstat (limited to 'cpp/test/Ice/info/TestI.cpp')
-rw-r--r-- | cpp/test/Ice/info/TestI.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/cpp/test/Ice/info/TestI.cpp b/cpp/test/Ice/info/TestI.cpp index ddacb9874dc..06e17ab89a1 100644 --- a/cpp/test/Ice/info/TestI.cpp +++ b/cpp/test/Ice/info/TestI.cpp @@ -16,6 +16,39 @@ using namespace std; using namespace Ice; using namespace Test; +namespace +{ + +Ice::IPEndpointInfoPtr +getIPEndpointInfo(const Ice::EndpointInfoPtr& info) +{ + for(Ice::EndpointInfoPtr p = info; p; p = p->underlying) + { + Ice::IPEndpointInfoPtr ipInfo = ICE_DYNAMIC_CAST(Ice::IPEndpointInfo, p); + if(ipInfo) + { + return ipInfo; + } + } + return ICE_NULLPTR; +} + +Ice::IPConnectionInfoPtr +getIPConnectionInfo(const Ice::ConnectionInfoPtr& info) +{ + for(Ice::ConnectionInfoPtr p = info; p; p = p->underlying) + { + Ice::IPConnectionInfoPtr ipInfo = ICE_DYNAMIC_CAST(Ice::IPConnectionInfo, p); + if(ipInfo) + { + return ipInfo; + } + } + return ICE_NULLPTR; +} + +} + void TestI::shutdown(const Ice::Current& current) { @@ -38,8 +71,8 @@ TestI::getEndpointInfoAsContext(const Ice::Current& c) os << info->type(); ctx["type"] = os.str(); - Ice::IPEndpointInfoPtr ipinfo = ICE_DYNAMIC_CAST(Ice::IPEndpointInfo, info); - test(info); + Ice::IPEndpointInfoPtr ipinfo = getIPEndpointInfo(info); + test(ipinfo); ctx["host"] = ipinfo->host; os.str(""); os << ipinfo->port; @@ -64,7 +97,7 @@ TestI::getConnectionInfoAsContext(const Ice::Current& c) ctx["incoming"] = info->incoming ? "true" : "false"; ostringstream os; - Ice::IPConnectionInfoPtr ipinfo = ICE_DYNAMIC_CAST(Ice::IPConnectionInfo, info); + Ice::IPConnectionInfoPtr ipinfo = getIPConnectionInfo(info); test(ipinfo); ctx["localAddress"] = ipinfo->localAddress; os.str(""); @@ -84,14 +117,5 @@ TestI::getConnectionInfoAsContext(const Ice::Current& c) } } - IceSSL::WSSConnectionInfoPtr wssinfo = ICE_DYNAMIC_CAST(IceSSL::WSSConnectionInfo, info); - if(wssinfo) - { - for(Ice::HeaderDict::const_iterator p = wssinfo->headers.begin(); p != wssinfo->headers.end(); ++p) - { - ctx["ws." + p->first] = p->second; - } - } - return ctx; } |