Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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
            }
        }