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; } }
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); } }
public void Consume(T stream, IStreamReadCompletion readCompletion) => this.readAction(stream, readCompletion);