Esempio n. 1
0
        public void Dispose()
        {
            ReceiveEvent.UserToken  = null;
            ReceiveEvent.Completed -= ReceiveSocketEvent_Completed;
            ReceiveEvent.SetBuffer(null);

            socketEventPool.Push(ReceiveEvent);

            SendEvent.UserToken  = null;
            SendEvent.Completed -= SendSocketEvnet_Completed;
            socketEventPool.Push(SendEvent);
        }
Esempio n. 2
0
        private SocketEventProvider(Session.Session session)
        {
            Sending = false;

            ReceiveEvent            = socketEventPool.Pop();
            ReceiveEvent.UserToken  = session;
            ReceiveEvent.Completed += ReceiveSocketEvent_Completed;

            // TODO: Memory Manager
            ReceiveEvent.SetBuffer(new byte[MaxBufferSize]);

            SendEvent            = socketEventPool.Pop();
            SendEvent.UserToken  = session;
            SendEvent.Completed += SendSocketEvnet_Completed;
        }