Exemple #1
0
 protected virtual void OnDispose()
 {
     try
     {
         object data = DequeueSendMessage();
         while (data != null)
         {
             if (data is IBuffer)
             {
                 ((IBuffer)data).Free();
             }
             data = DequeueSendMessage();
         }
         mReceiveArgs.Server  = null;
         mReceiveArgs.Session = null;
         mBaseNetStream.Dispose();
         if (mSslStream != null)
         {
             mSslStream.Dispose();
         }
         Server.CloseSession(this);
         Server            = null;
         ReceiveDispatcher = null;
         if (Packet != null)
         {
             Packet.Dispose();
         }
         mProperties.Clear();
     }
     catch
     {
     }
 }
Exemple #2
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (mPipeStream != null)
     {
         mPipeStream.Dispose();
         mPipeStream = null;
     }
 }
Exemple #3
0
 public void Dispose()
 {
     if (!mIsDisposed)
     {
         Client      = null;
         mIsDisposed = true;
         if (pipeStream != null)
         {
             pipeStream.Dispose();
             pipeStream = null;
         }
     }
 }
Exemple #4
0
 protected virtual void OnDispose()
 {
     try
     {
         object data = DequeueSendMessage();
         while (data != null)
         {
             if (data is IBuffer buffer)
             {
                 BeetleX.Buffers.Buffer.Free(buffer);
                 //((IBuffer)data).Free();
             }
             data = DequeueSendMessage();
         }
         if (SendEventArgs != null)
         {
             SendEventArgs.Dispose();
         }
         if (ReceiveEventArgs != null)
         {
             ReceiveEventArgs.Dispose();
         }
         mReceiveArgs.Server  = null;
         mReceiveArgs.Session = null;
         mBaseNetStream.Dispose();
         if (mSslStream != null)
         {
             mSslStream.Dispose();
         }
         Server.CloseSession(this);
         Server            = null;
         ReceiveDispatcher = null;
         if (Packet != null)
         {
             Packet.Dispose();
         }
         mProperties.Clear();
         if (SendBufferPool is PrivateBufferPool sendPool)
         {
             sendPool.Dispose();
         }
         if (ReceiveBufferPool is PrivateBufferPool receivePool)
         {
             receivePool.Dispose();
         }
     }
     catch
     {
     }
 }
Exemple #5
0
 protected virtual void OnDispose()
 {
     try
     {
         object data = DequeueSendMessage();
         while (data != null)
         {
             if (data is IBuffer buffer)
             {
                 BeetleX.Buffers.Buffer.Free(buffer);
             }
             data = DequeueSendMessage();
         }
         SendEventArgs?.Dispose();
         SendEventArgs?.Clear();
         ReceiveEventArgs?.Dispose();
         ReceiveEventArgs?.Clear();
         mReceiveArgs.Server  = null;
         mReceiveArgs.Session = null;
         mBaseNetStream.Dispose();
         if (mSslStream != null)
         {
             mSslStream.Dispose();
         }
         Server.CloseSession(this);
         ListenHandler     = null;
         ReceiveDispatcher = null;
         if (Packet != null)
         {
             Packet.Dispose();
         }
         ((IDisposable)Tag)?.Dispose();
         OnDisposeProperties();
         ((IDisposable)mToken)?.Dispose();
     }
     catch
     {
     }
     finally
     {
         Tag    = null;
         mToken = null;
     }
 }