Пример #1
0
 void OnRead(Tcp tcp, IStreamReadCompletion completion)
 {
     if (completion.Error != null ||
         completion.Completed)
     {
         tcp.CloseHandle(this.OnClose);
         this.server.CloseHandle(this.OnClose);
     }
     else
     {
         this.bytesRead += completion.Data.Count;
     }
 }
Пример #2
0
        public void Consume(T stream, IStreamReadCompletion readCompletion)
        {
            try
            {
                if (readCompletion.Error != null)
                {
                    this.onError(stream, readCompletion.Error);
                }
                else
                {
                    this.onAccept(stream, readCompletion.Data);
                }

                if (readCompletion.Completed)
                {
                    this.onCompleted(stream);
                }
            }
            catch (Exception exception)
            {
                this.onError(stream, exception);
            }
        }
Пример #3
0
 public void Consume(T stream, IStreamReadCompletion readCompletion) =>
 this.readAction(stream, readCompletion);