Esempio n. 1
0
        // The proxy returned re-uses the underlying connection. This is a special
        // mechanism for ProtocolMetaInfoPB.
        // Don't do this for any other protocol, it might cause a security hole.
        /// <exception cref="System.IO.IOException"/>
        private static ProtocolMetaInfoPB GetProtocolMetaInfoProxy(object proxy, Configuration
                                                                   conf)
        {
            RpcInvocationHandler inv = (RpcInvocationHandler)Proxy.GetInvocationHandler(proxy
                                                                                        );

            return(RPC.GetProtocolEngine(typeof(ProtocolMetaInfoPB), conf).GetProtocolMetaInfoProxy
                       (inv.GetConnectionId(), conf, NetUtils.GetDefaultSocketFactory(conf)).GetProxy());
        }
Esempio n. 2
0
        /// <summary>Return the connection ID of the given object.</summary>
        /// <remarks>
        /// Return the connection ID of the given object. If the provided object is in
        /// fact a protocol translator, we'll get the connection ID of the underlying
        /// proxy object.
        /// </remarks>
        /// <param name="proxy">the proxy object to get the connection ID of.</param>
        /// <returns>the connection ID for the provided proxy object.</returns>
        public static Client.ConnectionId GetConnectionIdForProxy(object proxy)
        {
            if (proxy is ProtocolTranslator)
            {
                proxy = ((ProtocolTranslator)proxy).GetUnderlyingProxyObject();
            }
            RpcInvocationHandler inv = (RpcInvocationHandler)Proxy.GetInvocationHandler(proxy
                                                                                        );

            return(inv.GetConnectionId());
        }