Beispiel #1
0
        private AsyncPatternResult<Stream, HttpCommand> OnBeginReadCompleted(IAsyncResult result, HttpCommand command)
        {
            var stream = command.HttpReadState.Stream;
            var bytesRead = stream.EndRead(result);

            if (bytesRead > 0 &&
                command.OnRead(bytesRead) &&
                command.HttpReadState.HasStillMoreBytesToRead)
            {
                return _readAsync.Continue(command.HttpReadState.Stream, command);
            }

            command.EndReading();
            RemoveFromPendingCommands(command);

            command.NotifyComplete();

            return _readAsync.Stop();
        }
Beispiel #2
0
        private void OnFailure(HttpCommand command)
        {
            command.EndReading();

            RemoveFromPendingCommands(command);

            _onFailure(this.ServerId, command);
        }