From 77beda421aa4cbe82b1bf7b7000ed456c0f16437 Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Tue, 5 May 2015 12:04:18 -0230 Subject: ICE-6479 info test failures with scripting languages --- ruby/src/IceRuby/Connection.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'ruby/src/IceRuby/Connection.cpp') diff --git a/ruby/src/IceRuby/Connection.cpp b/ruby/src/IceRuby/Connection.cpp index ecc5209c0d5..df2caa1000b 100644 --- a/ruby/src/IceRuby/Connection.cpp +++ b/ruby/src/IceRuby/Connection.cpp @@ -291,7 +291,26 @@ VALUE IceRuby::createConnectionInfo(const Ice::ConnectionInfoPtr& p) { VALUE info; - if(Ice::TCPConnectionInfoPtr::dynamicCast(p)) + if(Ice::WSConnectionInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_wsConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); + + Ice::WSConnectionInfoPtr ws = Ice::WSConnectionInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@localAddress"), createString(ws->localAddress)); + rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(ws->localPort)); + rb_ivar_set(info, rb_intern("@remoteAddress"), createString(ws->remoteAddress)); + rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(ws->remotePort)); + + volatile VALUE result = callRuby(rb_hash_new); + for(Ice::HeaderDict::const_iterator q = ws->headers.begin(); q != ws->headers.end(); ++q) + { + volatile VALUE key = createString(q->first); + volatile VALUE value = createString(q->second); + callRuby(rb_hash_aset, result, key, value); + } + rb_ivar_set(info, rb_intern("@headers"), result); + } + else if(Ice::TCPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_tcpConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); @@ -313,25 +332,6 @@ IceRuby::createConnectionInfo(const Ice::ConnectionInfoPtr& p) rb_ivar_set(info, rb_intern("@mcastAddress"), createString(udp->mcastAddress)); rb_ivar_set(info, rb_intern("@mcastPort"), INT2FIX(udp->mcastPort)); } - else if(Ice::WSConnectionInfoPtr::dynamicCast(p)) - { - info = Data_Wrap_Struct(_wsConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); - - Ice::WSConnectionInfoPtr ws = Ice::WSConnectionInfoPtr::dynamicCast(p); - rb_ivar_set(info, rb_intern("@localAddress"), createString(ws->localAddress)); - rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(ws->localPort)); - rb_ivar_set(info, rb_intern("@remoteAddress"), createString(ws->remoteAddress)); - rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(ws->remotePort)); - - volatile VALUE result = callRuby(rb_hash_new); - for(Ice::HeaderDict::const_iterator q = ws->headers.begin(); q != ws->headers.end(); ++q) - { - volatile VALUE key = createString(q->first); - volatile VALUE value = createString(q->second); - callRuby(rb_hash_aset, result, key, value); - } - rb_ivar_set(info, rb_intern("@headers"), result); - } else if(Ice::IPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_ipConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); -- cgit v1.2.3