Skip to content

Commit

Permalink
Non-issue : Fixed a minor bug in async streams resume() method
Browse files Browse the repository at this point in the history
  • Loading branch information
khelle committed Dec 18, 2016
1 parent 6a48415 commit 6d8498f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Stream/AsyncStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,17 @@ public function pause()
*/
public function resume()
{
if ($this->readable && $this->paused)
if (($this->writable || $this->readable) && $this->paused)
{
$this->paused = false;

if ($this->readingStarted)
if ($this->readable && $this->readingStarted)
{
$this->reading = true;
$this->loop->addReadStream($this->resource, [ $this, 'handleRead' ]);
}

if ($this->buffer->isEmpty() === false)
if ($this->writable && $this->buffer->isEmpty() === false)
{
$this->writing = true;
$this->loop->addWriteStream($this->resource, [ $this, 'handleWrite' ]);
Expand Down
2 changes: 1 addition & 1 deletion src/Stream/AsyncStreamReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function pause()
*/
public function resume()
{
if ($this->paused)
if ($this->readable && $this->paused)
{
$this->paused = false;
if ($this->readingStarted)
Expand Down
2 changes: 1 addition & 1 deletion src/Stream/AsyncStreamWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function pause()
*/
public function resume()
{
if ($this->paused)
if ($this->writable && $this->paused)
{
$this->paused = false;
if ($this->buffer->isEmpty() === false)
Expand Down

0 comments on commit 6d8498f

Please sign in to comment.