public IncomingComplete ( int count, |
||
count | int | |
error | ||
return | void |
private void OnRead(UvStreamHandle handle, int status) { var normalRead = status > 0; var normalDone = status == 0 || status == Constants.ECONNRESET || status == Constants.EOF; var errorDone = !(normalDone || normalRead); var readCount = normalRead ? status : 0; if (normalRead) { Log.ConnectionRead(_connectionId, readCount); } else { _socket.ReadStop(); Log.ConnectionReadFin(_connectionId); } Exception error = null; if (errorDone) { handle.Libuv.Check(status, out error); } _rawSocketInput.IncomingComplete(readCount, error); }
private void OnRead(UvStreamHandle handle, int readCount, int errorCode, Exception error) { var normalRead = readCount != 0 && errorCode == 0; var normalDone = readCount == 0 && (errorCode == 0 || errorCode == Constants.ECONNRESET || errorCode == Constants.EOF); var errorDone = !(normalDone || normalRead); if (normalRead) { Log.ConnectionRead(_connectionId, readCount); } else if (normalDone || errorDone) { _socket.ReadStop(); Log.ConnectionReadFin(_connectionId); } SocketInput.IncomingComplete(readCount, errorDone ? error : null); }
public void EmptyHeaderValuesCanBeParsed(string rawHeaders, int numHeaders) { var socketInput = new SocketInput(new MemoryPool2()); var headerCollection = new FrameRequestHeaders(); var headerArray = Encoding.ASCII.GetBytes(rawHeaders); var inputBuffer = socketInput.IncomingStart(headerArray.Length); Buffer.BlockCopy(headerArray, 0, inputBuffer.Data.Array, inputBuffer.Data.Offset, headerArray.Length); socketInput.IncomingComplete(headerArray.Length, null); var success = Frame.TakeMessageHeaders(socketInput, headerCollection); Assert.True(success); Assert.Equal(numHeaders, headerCollection.Count()); // Assert TakeMessageHeaders consumed all the input var scan = socketInput.ConsumingStart(); Assert.True(scan.IsEnd); }