Inheritance: IDisposable
Exemplo n.º 1
0
 internal void AttachToIoThread(TransportPipe pipe, int threadNumber = 0)
 {
     if(threadNumber >= _sendingThreads.Count)
         throw new ArgumentException("Sending Thread number exceeds the number of sending threads");
     _sendingThreads[threadNumber].Attach(pipe);
     _pipesToThreadNumber[pipe] = threadNumber;
 }
Exemplo n.º 2
0
 public void Detach(TransportPipe pipe)
 {
     var waitHandle = new AutoResetEvent(false);
     _commands.Add(() =>
                       {
                           RemovePipe(pipe);
                           waitHandle.Set();
                       });
     waitHandle.WaitOne();
 }
Exemplo n.º 3
0
 internal void Attach(TransportPipe pipe)
 {
     _commands.Add(() =>
     {
         var socketAsyncEventArgs = new SocketAsyncEventArgs();
         var sendingPipeInfo = new SendingPipeInfo(pipe, socketAsyncEventArgs);
         socketAsyncEventArgs.UserToken = sendingPipeInfo;
         socketAsyncEventArgs.Completed += OnSendCompleted;
         _transportPipes.Add(sendingPipeInfo);
         CreateSocketForEndpoint(sendingPipeInfo);
     });
 }
Exemplo n.º 4
0
 public SendingPipeInfo(TransportPipe pipe, SocketAsyncEventArgs eventArgs)
 {
     Pipe = pipe;
     EventArgs = eventArgs;
 }
Exemplo n.º 5
0
 private void RemovePipe(TransportPipe pipe)
 {
     var pipeInfo = _transportPipes.Single(x => x.Pipe == pipe);
     _transportPipes.Remove(pipeInfo);
     var socket = pipeInfo.Socket;
     if (socket != null)
         socket.Dispose();
 }
Exemplo n.º 6
0
 public void DetachFromIoThread(TransportPipe pipe)
 {
     var threadNumber = _pipesToThreadNumber[pipe];
     _sendingThreads[threadNumber].Detach(pipe);
 }