Skip to content

Commit 2828fa3

Browse files
committed
fix stream
1 parent 4f80c02 commit 2828fa3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Bandwidth.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ public function file(string $path, $p = 0, $length = -1)
6565

6666
public function stream($stream)
6767
{
68-
$stream = new \React\Stream\ThroughStream();
69-
$stream->on('data', function ($data) use ($stream) {
70-
$this->concurrent->concurrent(function() use ($stream, $data){
71-
return $this->bucket->removeTokens(1024 * strlen($data))->then(function () use ($stream, $data) {
72-
$stream->write($data);
68+
$_stream = new \React\Stream\ThroughStream();
69+
$stream->on('data', function ($data) use ($_stream) {
70+
$this->concurrent->concurrent(function() use ($_stream, $data){
71+
return $this->bucket->removeTokens(1024 * strlen($data))->then(function () use ($_stream, $data) {
72+
$_stream->write($data);
7373
});
7474
});
7575
});
76-
return $stream;
76+
return $_stream;
7777
}
7878

7979
protected function fileStream($file, $stream, $p, $size)

0 commit comments

Comments
 (0)