예제 #1
0
 private void ActivateDisConnectedEvent(string userID, DisconnectedCause cause)
 {
     if (this.SomeOneDisconnected != null)
     {
         this.SomeOneDisconnected(userID, cause);
     }
 }
예제 #2
0
        //将指定连接从列表中移除,并将用户任务上报
        private void UngisterUser(string userID, DisconnectedCause cause)
        {
            if (this.htableClient[userID] == null)
            {
                return;
            }

            //上报任务
            ITaskMainRecord mainRecord = (ITaskMainRecord)this.htableClient[userID];

            mainRecord.TimeLogout     = DateTime.Now;
            mainRecord.RequestCount   = mainRecord.Details.Count;
            mainRecord.TotalDataCount = this.GetTotalDataLen(mainRecord);
            this.taskReporter.RecordTaskList(mainRecord);

            this.rwLocker.AcquireWriterLock(TcpUserManager.WaitLockerSpan);
            this.htableClient.Remove(userID);
            this.htableConnect.Remove(userID);
            this.rwLocker.ReleaseWriterLock();

            //更新显示
            this.tcpUserDisplayer.RemoveUser(userID, cause);

            //触发事件
            this.ActivateDisConnectedEvent(userID, cause);
        }
예제 #3
0
        public void DisposeOneConnection(int connectID, DisconnectedCause cause)
        {
            ISafeNetworkStream stream = this.contextKeyManager.GetNetStream(connectID);

            if (stream == null)
            {
                return;
            }

            this.contextKeyManager.RemoveContextKey(connectID);
            stream.Close();

            if (this.SomeOneDisConnected != null)
            {
                this.SomeOneDisConnected(connectID, cause);
            }
        }
예제 #4
0
        public void DisposeOneConnection(int connectID, DisconnectedCause cause)
        {
            this.rwLocker.AcquireReaderLock(TcpUserManager.WaitLockerSpan);
            string dest = null;

            foreach (string userID in this.htableConnect.Keys)
            {
                if (((int)this.htableConnect[userID]) == connectID)
                {
                    dest = userID;
                    break;
                }
            }
            this.rwLocker.ReleaseReaderLock();

            if (dest != null)
            {
                this.DisposeOneUser(dest, cause);
            }
        }
예제 #5
0
 public void RemoveUser(string userID, DisconnectedCause cause)
 {
     // TODO:  添加 TcpUserDisplayer.RemoveUser 实现
     if (this.InvokeRequired)
     {
         object[] args = { userID, cause };
         this.Invoke(new CallBackRemoveUser(this.RemoveUser), args);
     }
     else
     {
         foreach (ListViewItem item in this.listView1.Items)
         {
             if (item.SubItems[0].Text.Trim() == userID)
             {
                 this.listView1.Items.Remove(item);
                 break;
             }
         }
     }
 }
예제 #6
0
 public void RemoveUser(string userID, DisconnectedCause cause)
 {
     // TODO:  添加 EmptyTcpDisplayer.RemoveUser 实现
 }
예제 #7
0
        public void DisposeOneUser(string userID, DisconnectedCause cause)
        {
            this.tcpUserOnLineChecker.UnregisterUser(userID);

            this.UngisterUser(userID, cause);
        }
예제 #8
0
 private void theTcp_SomeOneDisConnected(int ConnectID, DisconnectedCause cause)
 {
     this.tcpUserManager.DisposeOneConnection(ConnectID, cause);
 }