示例#1
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     if (Interlocked.CompareExchange(ref isDisposed, 1, 0) == 0)
     {
         (checkSocketVersion as IDisposable).Dispose();
         if (Processor != null)
         {
             Processor.Free();
         }
     }
 }
 /// <summary>
 /// TCP 客户端套接字初始化处理
 /// </summary>
 /// <param name="socket"></param>
 private void onClientSocket(AutoCSer.Net.TcpServer.ClientSocketBase socket)
 {
     Abstract.QueueConsumerStreamProcessor oldProcesser = Processor;
     if (socket != null)
     {
         createProcessor();
     }
     else
     {
         Processor = null;
     }
     if (oldProcesser != null)
     {
         oldProcesser.Free();
     }
 }
示例#3
0
 /// <summary>
 /// 重启处理器
 /// </summary>
 /// <param name="processor"></param>
 internal void ReStartProcessor(QueueConsumerStreamProcessor processor)
 {
     if (IsProcessor(processor))
     {
         object setSocketLock = client._TcpClient_.SetSocketLock;
         Monitor.Enter(setSocketLock);
         try
         {
             if (IsProcessor(processor))
             {
                 Processor = null;
                 reStartProcessor();
             }
         }
         finally { Monitor.Exit(setSocketLock); }
     }
     processor.Free();
 }