private void OnSessionDestroyed(Object sender, IoSessionEventArgs e) { AsyncSocketSession s = e.Session as AsyncSocketSession; if (s != null && _readWritePool != null) { _readWritePool.Push(s.ReadBuffer); _readWritePool.Push(s.WriteBuffer); } }
private void OnSessionDestroyed(Object sender, IoSessionEventArgs e) { AsyncSocketSession s = e.Session as AsyncSocketSession; if (s != null) { // clear the buffer and reset its count to original capacity if changed s.ReadBuffer.Dispose(); s.WriteBuffer.Dispose(); } }
private void OnSessionDestroyed(Object sender, IoSessionEventArgs e) { AsyncSocketSession s = e.Session as AsyncSocketSession; if (s != null && _readWritePool != null) { // clear the buffer and reset its count to original capacity if changed s.ReadBuffer.Clear(); s.ReadBuffer.SetBuffer(); _readWritePool.Push(s.ReadBuffer); s.WriteBuffer.Clear(); s.WriteBuffer.SetBuffer(); _readWritePool.Push(s.WriteBuffer); } }
void readWriteEventArg_Completed(object sender, SocketAsyncEventArgs e) { AsyncSocketSession session = e.UserToken as AsyncSocketSession; if (session == null) { return; } if (e.LastOperation == SocketAsyncOperation.Receive) { session.ProcessReceive(e); } else if (e.LastOperation == SocketAsyncOperation.Send || e.LastOperation == SocketAsyncOperation.SendPackets) { session.ProcessSend(e); } else { // TODO handle other Socket operations } }