Skip to content

Commit f3dc3fc

Browse files
committed
Merge branch 'compat'
# Conflicts: # src/Server.php
2 parents b4baa1e + 7065da5 commit f3dc3fc

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.3
45
- 5.4
56
- 5.5
67
- 5.6

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"keywords": ["socket"],
55
"license": "MIT",
66
"require": {
7-
"php": ">=5.4.0",
8-
"evenement/evenement": "~2.0",
9-
"react/event-loop": "0.4.*",
10-
"react/stream": "0.4.*"
7+
"php": ">=5.3.0",
8+
"evenement/evenement": "~2.0|~1.0",
9+
"react/event-loop": "0.4.*|0.3.*",
10+
"react/stream": "0.4.*|0.3.*"
1111
},
1212
"autoload": {
1313
"psr-4": {

src/Server.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ public function listen($port, $host = '127.0.0.1')
3030
}
3131
stream_set_blocking($this->master, 0);
3232

33-
$this->loop->addReadStream($this->master, function ($master) {
33+
$that = $this;
34+
35+
$this->loop->addReadStream($this->master, function ($master) use ($that) {
3436
$newSocket = @stream_socket_accept($master);
3537
if (false === $newSocket) {
36-
$this->emit('error', array(new \RuntimeException('Error accepting new connection')));
38+
$that->emit('error', array(new \RuntimeException('Error accepting new connection')));
3739

3840
return;
3941
}
40-
$this->handleConnection($newSocket);
42+
$that->handleConnection($newSocket);
4143
});
4244
}
4345

0 commit comments

Comments
 (0)