/// <summary> /// 释放接收数据缓冲区与异步事件对象 /// </summary> private void close() { if (Socket != null) { try { #if DOTNET2 DisposeSocket(); #else if (asyncEventArgs == null) DisposeSocket(); else { asyncEventArgs.Completed -= onReceive; DisposeSocket(); SocketAsyncEventArgsPool.PushNotNull(ref asyncEventArgs); } #endif } catch (Exception error) { Server.AddLog(error); } Buffer.Free(); ReceiveBigBuffer.TryFree(); FreeSerializer(); } }
/// <summary> /// 释放接收数据缓冲区与异步事件对象 /// </summary> private void close() { if (isClose) freeOutput(); else { isClose = true; try { #if DOTNET2 if (onSendAsyncCallback != null) { onSendAsyncCallback = null; ServerSocket.DisposeSocket(); } #else if (sendAsyncEventArgs != null) { sendAsyncEventArgs.Completed -= onSend; ServerSocket.DisposeSocket(); SocketAsyncEventArgsPool.PushNotNull(ref sendAsyncEventArgs); } #endif } catch (Exception error) { Server.AddLog(error); } freeBuffer(); callOnClose(); } }
internal void Free() { #if !DOTNET2 receiveAsyncEventArgs.Completed -= onReceive; SocketAsyncEventArgsPool.PushNotNull(ref receiveAsyncEventArgs); #endif Buffer.Free(); }
/// <summary> /// 释放资源 /// </summary> public override void Dispose() { #if DOTNET2 if (onReceiveAsyncCallback != null) #else if (receiveAsyncEventArgs != null) #endif { #if DOTNET2 onReceiveAsyncCallback = onSendAsyncCallback = null; #else receiveAsyncEventArgs.Completed -= onReceiveAsyncCallback; sendAsyncEventArgs.Completed -= onSendAsyncCallback; SocketAsyncEventArgsPool.PushNotNull(ref receiveAsyncEventArgs); SocketAsyncEventArgsPool.PushNotNull(ref sendAsyncEventArgs); #endif Buffer.Free(); Header.Free(); #if !DOTNET2 if (boundaryReceiver == null) boundaryReceiver.Free(); #endif } }
/// <summary> /// 释放接收数据缓冲区与异步事件对象 /// </summary> private void close() { try { #if DOTNET2 DisposeSocket(); #else if (receiveAsyncEventArgs == null) DisposeSocket(); else { receiveAsyncEventArgs.Completed -= onReceive; DisposeSocket(); SocketAsyncEventArgsPool.PushNotNull(ref receiveAsyncEventArgs); } #endif } catch (Exception error) { Server.AddLog(error); } CloseFree(); if (Sender != null) Sender.Close(); }
/// <summary> /// 释放接收数据缓冲区与异步事件对象 /// </summary> private void close() { isClose = true; try { #if DOTNET2 DisposeSocket(); #else if (receiveAsyncEventArgs == null) DisposeSocket(); else { receiveAsyncEventArgs.Completed -= onReceive; DisposeSocket(); SocketAsyncEventArgsPool.PushNotNull(ref receiveAsyncEventArgs); } #endif } catch (Exception error) { ClientCreator.CommandClient.AddLog(error); } CloseFree(); }
internal void Free() { socketAsyncEventArgs.Completed -= onReceiveAsyncCallback; SocketAsyncEventArgsPool.PushNotNull(ref socketAsyncEventArgs); }