|
34 | 34 | * @see ServerInterface |
35 | 35 | * @see ConnectionInterface |
36 | 36 | */ |
37 | | -class Server extends EventEmitter implements ServerInterface |
| 37 | +final class Server extends EventEmitter implements ServerInterface |
38 | 38 | { |
39 | 39 | private $master; |
40 | 40 | private $loop; |
@@ -100,7 +100,7 @@ class Server extends EventEmitter implements ServerInterface |
100 | 100 | * and/or PHP version. |
101 | 101 | * Passing unknown context options has no effect. |
102 | 102 | * |
103 | | - * @param string $uri |
| 103 | + * @param string|int $uri |
104 | 104 | * @param LoopInterface $loop |
105 | 105 | * @param array $context |
106 | 106 | * @throws InvalidArgumentException if the listening address is invalid |
@@ -165,15 +165,6 @@ public function __construct($uri, LoopInterface $loop, array $context = array()) |
165 | 165 | }); |
166 | 166 | } |
167 | 167 |
|
168 | | - public function handleConnection($socket) |
169 | | - { |
170 | | - stream_set_blocking($socket, 0); |
171 | | - |
172 | | - $client = $this->createConnection($socket); |
173 | | - |
174 | | - $this->emit('connection', array($client)); |
175 | | - } |
176 | | - |
177 | 168 | public function getAddress() |
178 | 169 | { |
179 | 170 | if (!is_resource($this->master)) { |
@@ -203,8 +194,11 @@ public function close() |
203 | 194 | $this->removeAllListeners(); |
204 | 195 | } |
205 | 196 |
|
206 | | - public function createConnection($socket) |
| 197 | + /** @internal */ |
| 198 | + public function handleConnection($socket) |
207 | 199 | { |
208 | | - return new Connection($socket, $this->loop); |
| 200 | + $this->emit('connection', array( |
| 201 | + new Connection($socket, $this->loop) |
| 202 | + )); |
209 | 203 | } |
210 | 204 | } |
0 commit comments