コード例 #1
0
 public DequeueAsyncResult(MakeConnection poll, PollingDuplexSession session, TimeSpan timeout, AsyncCallback callback, object state)
 {
     this.AsyncState = state;
     this.Callback   = callback;
     this.Session    = session;
     this.Poll       = poll;
     this.Timeout    = timeout;
     this.Tags       = new RdlTagCollection();
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the DuplexClient class.
 /// </summary>
 /// <param name="receiver">The IGameClient instance used to send data back to the connected client.</param>
 public DuplexNetworkClient(PollingDuplexSession duplexSession)
 {
     this.Context           = new DuplexMessageContext(this);
     this.AuthKey           = AuthKey.Empty;
     this.LastHeartbeatDate = DateTime.Now;
     this.Handler           = new LoginCommandHandler(this);
     this.SessionId         = new Guid(duplexSession.SessionId);
     this.Address           = duplexSession.Address;
     this.Connected         = true;
 }
コード例 #3
0
        public IAsyncResult BeginMakeConnect(MakeConnection poll, AsyncCallback callback, object state)
        {
            Logger.LogDebug("SERVER: BeginMakeConnect {0}", poll.Address);
            var client = Game.Server.Clients.Where(c => c.Address == poll.Address).FirstOrDefault();
            PollingDuplexSession session = null;

            if (client != null)
            {
                session = new PollingDuplexSession(client.Address, client.SessionId.ToString());
            }
            else
            {
                session = new PollingDuplexSession(poll.Address, String.Empty);
            }

            var ar = new DequeueAsyncResult(poll, session, _pollTimeout, callback, state);

            ThreadPool.QueueUserWorkItem(StartMessageRead, ar);

            return(ar);
        }