Exemplo n.º 1
0
 public void Return(EventArgsPair eventArgs)
 {
     lock (syncRoot)
     {
         eventArgs.Send.SetBuffer(eventArgs.BufferOffset, bufferSize * 2);
         eventArgs.Receive.SetBuffer(eventArgs.BufferOffset, bufferSize * 2);
         pool.Push(eventArgs);
     }
 }
Exemplo n.º 2
0
            public Channel(Direction direction, Socket source, Socket target, ProxyClient client)
            {
                this.direction = direction;
                this.source    = source;
                this.target    = target;
                this.client    = client;

                eventArgs = client.eventArgsManager.Take();
                eventArgs.Send.Completed    += SendEventArgs_Completed;
                eventArgs.Receive.Completed += ReceiveEventArgs_Completed;
            }
Exemplo n.º 3
0
            public void Dispose()
            {
                if (!disposed)
                {
                    var eventArgs = this.eventArgs;
                    this.eventArgs = null;

                    if (eventArgs != null)
                    {
                        eventArgs.Send.Completed    -= SendEventArgs_Completed;
                        eventArgs.Receive.Completed -= ReceiveEventArgs_Completed;
                        client.eventArgsManager.Return(eventArgs);
                    }

                    disposed = true;
                }
            }