diff options
Diffstat (limited to 'ruby/src')
-rw-r--r-- | ruby/src/IceRuby/Connection.cpp | 40 | ||||
-rw-r--r-- | ruby/src/IceRuby/Endpoint.cpp | 22 |
2 files changed, 31 insertions, 31 deletions
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)); diff --git a/ruby/src/IceRuby/Endpoint.cpp b/ruby/src/IceRuby/Endpoint.cpp index 746f87c7ba0..c6f8d8565e3 100644 --- a/ruby/src/IceRuby/Endpoint.cpp +++ b/ruby/src/IceRuby/Endpoint.cpp @@ -130,7 +130,17 @@ VALUE IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) { VALUE info; - if(Ice::TCPEndpointInfoPtr::dynamicCast(p)) + if(Ice::WSEndpointInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_wsEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); + + Ice::WSEndpointInfoPtr ws = Ice::WSEndpointInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@host"), createString(ws->host)); + rb_ivar_set(info, rb_intern("@port"), INT2FIX(ws->port)); + rb_ivar_set(info, rb_intern("@sourceAddress"), createString(ws->sourceAddress)); + rb_ivar_set(info, rb_intern("@resource"), createString(ws->resource)); + } + else if(Ice::TCPEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_tcpEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); @@ -150,16 +160,6 @@ IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) rb_ivar_set(info, rb_intern("@mcastInterface"), createString(udp->mcastInterface)); rb_ivar_set(info, rb_intern("@mcastTtl"), INT2FIX(udp->mcastTtl)); } - else if(Ice::WSEndpointInfoPtr::dynamicCast(p)) - { - info = Data_Wrap_Struct(_wsEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); - - Ice::WSEndpointInfoPtr ws = Ice::WSEndpointInfoPtr::dynamicCast(p); - rb_ivar_set(info, rb_intern("@host"), createString(ws->host)); - rb_ivar_set(info, rb_intern("@port"), INT2FIX(ws->port)); - rb_ivar_set(info, rb_intern("@sourceAddress"), createString(ws->sourceAddress)); - rb_ivar_set(info, rb_intern("@resource"), createString(ws->resource)); - } else if(Ice::OpaqueEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_opaqueEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); |