Beispiel #1
0
 /// <summary>
 /// 释放IUserToken
 /// </summary>
 /// <param name="userToken"></param>
 public bool Free(IUserToken userToken)
 {
     _session.Del(userToken.ID);
     if (userToken.Socket != null && userToken.Socket.Connected)
     {
         try
         {
             userToken.Socket.Shutdown(SocketShutdown.Both);
         }
         catch { }
         _bufferManager.FreeBuffer(userToken.ReadArgs);
         _argsPool.Push(userToken.ReadArgs);
         _argsPool.Push(userToken.WriteArgs);
         userToken.Dispose();
         return(true);
     }
     return(false);
 }