From c05d1b41c285c8e65e305c512323b596cd4a1c16 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 26 Jun 2017 17:25:01 -0700 Subject: Some fixes for tests and change contract --- src/objective-c/RxLibrary/GRXBufferedPipe.h | 4 ++-- src/objective-c/RxLibrary/GRXBufferedPipe.m | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/objective-c') diff --git a/src/objective-c/RxLibrary/GRXBufferedPipe.h b/src/objective-c/RxLibrary/GRXBufferedPipe.h index bd7d4ad691..a871ea895a 100644 --- a/src/objective-c/RxLibrary/GRXBufferedPipe.h +++ b/src/objective-c/RxLibrary/GRXBufferedPipe.h @@ -27,8 +27,8 @@ * immediately, unless flow control prevents it. * If it is throttled and keeps receiving values, as well as if it receives values before being * started, it will buffer them and propagate them in order as soon as its state becomes Started. - * If it receives an error (via -writesFinishedWithError:), it will drop any buffered values and - * propagate the error immediately. + * If it receives an end of stream (via -writesFinishedWithError:), it will buffer the EOS after the + * last buffered value and issue it to the writeable after all buffered values are issued. * * Beware that a pipe of this type can't prevent receiving more values when it is paused (for * example if used to write data to a congested network connection). Because in such situations the diff --git a/src/objective-c/RxLibrary/GRXBufferedPipe.m b/src/objective-c/RxLibrary/GRXBufferedPipe.m index 6433b62578..99cb0ad971 100644 --- a/src/objective-c/RxLibrary/GRXBufferedPipe.m +++ b/src/objective-c/RxLibrary/GRXBufferedPipe.m @@ -60,7 +60,7 @@ - (void)writesFinishedWithError:(NSError *)errorOrNil { __weak GRXBufferedPipe *weakSelf = self; dispatch_async(_writeQueue, ^{ - [weakSelf finishWithError:nil]; + [weakSelf finishWithError:errorOrNil]; }); } @@ -88,8 +88,7 @@ } return; case GRXWriterStateStarted: - if (_state == GRXWriterStatePaused || - _state == GRXWriterStateNotStarted) { + if (_state == GRXWriterStatePaused) { _state = newState; dispatch_resume(_writeQueue); } @@ -102,7 +101,8 @@ - (void)startWithWriteable:(id)writeable { self.writeable = writeable; - self.state = GRXWriterStateStarted; + _state = GRXWriterStateStarted; + dispatch_resume(_writeQueue); } - (void)finishWithError:(NSError *)errorOrNil { -- cgit v1.2.3