Skip to content

Commit

Permalink
Close can only be called once
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Jul 6, 2017
1 parent 7bf65ba commit 51630e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ReadableStreamHash.php
Expand Up @@ -31,7 +31,7 @@ public function __construct(ReadableStreamInterface $stream, string $hash, int $
$this->emit('data', [$data]);
hash_update($this->context, $data);
});
$this->stream->on('close', function () {
$this->stream->once('close', function () {
$this->emit('close');
$this->emit('hash', [
hash_final($this->context),
Expand Down
2 changes: 1 addition & 1 deletion src/WritableStreamHash.php
Expand Up @@ -25,7 +25,7 @@ public function __construct(WritableStreamInterface $stream, string $hash, int $
{
$this->stream = $stream;
$this->context = hash_init($hash, $options, $key);
$this->stream->on('close', function () {
$this->stream->once('close', function () {
$this->emit('hash', [
hash_final($this->context),
]);
Expand Down

0 comments on commit 51630e2

Please sign in to comment.