@@ 176-188 (lines=13) @@ | ||
173 | ||
174 | protected function setupStreams(LoopDecorator $loop) |
|
175 | { |
|
176 | $loop->on('addReadStream', function ($stream) { |
|
177 | $key = (int) $stream; |
|
178 | ||
179 | $this->streamsRead[$key] = $stream; |
|
180 | $this->streamsDuplex[$key] = $stream; |
|
181 | ||
182 | GlobalState::set('streams.read.current', count($this->streamsRead)); |
|
183 | GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
|
184 | GlobalState::incr('streams.read.total'); |
|
185 | if (!isset($this->streamsWrite[$key])) { |
|
186 | GlobalState::incr('streams.total.total'); |
|
187 | } |
|
188 | }); |
|
189 | $loop->on('readStreamTick', function () { |
|
190 | GlobalState::incr('streams.read.ticks'); |
|
191 | GlobalState::incr('streams.total.ticks'); |
|
@@ 207-220 (lines=14) @@ | ||
204 | GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
|
205 | }); |
|
206 | ||
207 | $loop->on('addWriteStream', function ($stream) { |
|
208 | $key = (int) $stream; |
|
209 | ||
210 | $this->streamsWrite[$key] = $stream; |
|
211 | $this->streamsDuplex[$key] = $stream; |
|
212 | ||
213 | GlobalState::set('streams.write.current', count($this->streamsWrite)); |
|
214 | GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
|
215 | GlobalState::incr('streams.write.total'); |
|
216 | ||
217 | if (!isset($this->streamsRead[$key])) { |
|
218 | GlobalState::incr('streams.total.total'); |
|
219 | } |
|
220 | }); |
|
221 | $loop->on('writeStreamTick', function () { |
|
222 | GlobalState::incr('streams.write.ticks'); |
|
223 | GlobalState::incr('streams.total.ticks'); |