示例#1
0
        private EndpointProxy CreateProxy()
        {
            EndpointProxy e = new EndpointProxy(this._handler);

            this._connected.Add(e);
            return(e);
        }
示例#2
0
        public EndpointProxy GetEndpoint(Identity target, string uri, IDictionary <string, object> extras)
        {
            EndpointProxy e = this.GetEndpoint(target) ?? this.CreateProxy();

            e.Identity = target;
            // always clear, cached proxy will have broken channel
            e.Remove(uri);
            // always reget channel, make sure it's valid
            IClientChannel channel = this.ChannelSelector.GetChannel(new Uri(uri));
            // connect message
            Message msg = new Message();

            msg.MessageType = MessageType.CONNECT;
            IDictionary <string, object> content = new Dictionary <string, object>();

            this.Identity.Render(content);
            // pass extra data
            if (extras != null)
            {
                foreach (var p in extras)
                {
                    content.Add(p);
                }
            }
            msg.Content = content;
            this._handler.SendAndWait(e, channel, msg, TIMEOUT);
            e.Add(channel);
            return(e);
        }
示例#3
0
 internal IDictionary<string, object> SendAndWait(EndpointProxy e
     , IChannelSender sender
     , Message message
     , int timeout)
 {
     SendCallback callback = new SendCallback(e);
     this.Send(message, sender, callback);
     callback.WaitReturn(timeout);
     if (callback.Error != null)
         throw callback.Error;
     return callback.Return;
 }
示例#4
0
        internal IDictionary <string, object> SendAndWait(EndpointProxy e
                                                          , IChannelSender sender
                                                          , Message message
                                                          , int timeout)
        {
            SendCallback callback = new SendCallback(e);

            this.Send(message, sender, callback);
            callback.WaitReturn(timeout);
            if (callback.Error != null)
            {
                throw callback.Error;
            }
            return(callback.Return);
        }
示例#5
0
 public SendCallback(EndpointProxy endpointProxy)
 {
     this.Target = endpointProxy;
     this._handle = new EventWaitHandle(false, EventResetMode.AutoReset);
 }
示例#6
0
 public SendCallback(EndpointProxy endpointProxy)
 {
     this.Target  = endpointProxy;
     this._handle = new EventWaitHandle(false, EventResetMode.AutoReset);
 }
示例#7
0
 private EndpointProxy CreateProxy()
 {
     EndpointProxy e = new EndpointProxy(this._handler);
     this._connected.Add(e);
     return e;
 }