|
@@ 152-164 (lines=13) @@
|
| 149 |
|
|
| 150 |
|
protected function setupStreams(LoopDecorator $loop) |
| 151 |
|
{ |
| 152 |
|
$loop->on('addReadStream', function ($stream) { |
| 153 |
|
$key = (int) $stream; |
| 154 |
|
|
| 155 |
|
$this->streamsRead[$key] = $stream; |
| 156 |
|
$this->streamsDuplex[$key] = $stream; |
| 157 |
|
|
| 158 |
|
GlobalState::set('streams.read.current', count($this->streamsRead)); |
| 159 |
|
GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
| 160 |
|
GlobalState::incr('streams.read.total'); |
| 161 |
|
if (!isset($this->streamsWrite[$key])) { |
| 162 |
|
GlobalState::incr('streams.total.total'); |
| 163 |
|
} |
| 164 |
|
}); |
| 165 |
|
$loop->on('readStreamTick', function () { |
| 166 |
|
GlobalState::incr('streams.read.ticks'); |
| 167 |
|
GlobalState::incr('streams.total.ticks'); |
|
@@ 183-196 (lines=14) @@
|
| 180 |
|
GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
| 181 |
|
}); |
| 182 |
|
|
| 183 |
|
$loop->on('addWriteStream', function ($stream) { |
| 184 |
|
$key = (int) $stream; |
| 185 |
|
|
| 186 |
|
$this->streamsWrite[$key] = $stream; |
| 187 |
|
$this->streamsDuplex[$key] = $stream; |
| 188 |
|
|
| 189 |
|
GlobalState::set('streams.write.current', count($this->streamsWrite)); |
| 190 |
|
GlobalState::set('streams.total.current', count($this->streamsDuplex)); |
| 191 |
|
GlobalState::incr('streams.write.total'); |
| 192 |
|
|
| 193 |
|
if (!isset($this->streamsRead[$key])) { |
| 194 |
|
GlobalState::incr('streams.total.total'); |
| 195 |
|
} |
| 196 |
|
}); |
| 197 |
|
$loop->on('writeStreamTick', function () { |
| 198 |
|
GlobalState::incr('streams.write.ticks'); |
| 199 |
|
GlobalState::incr('streams.total.ticks'); |