Skip to content

Commit 6b65f12

Browse files
committed
Simplify usage by supporting new Socket API
1 parent d0f42b2 commit 6b65f12

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ proxy servers etc.), you can explicitly pass a custom instance of the
7474
[`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface):
7575

7676
```php
77-
$connector = new React\Socket\Connector(null, array(
77+
$connector = new React\Socket\Connector(array(
7878
'dns' => '127.0.0.1',
7979
'tcp' => array(
8080
'bindto' => '192.168.10.1:0'

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"react/promise": "^2.7",
1111
"react/promise-stream": "^1.1",
1212
"react/promise-timer": "^1.5",
13-
"react/socket": "^1.8"
13+
"react/socket": "^1.9"
1414
},
1515
"require-dev": {
1616
"clue/block-react": "^1.2",

src/Factory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Factory
4242
* [`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface):
4343
*
4444
* ```php
45-
* $connector = new React\Socket\Connector(null, array(
45+
* $connector = new React\Socket\Connector(array(
4646
* 'dns' => '127.0.0.1',
4747
* 'tcp' => array(
4848
* 'bindto' => '192.168.10.1:0'
@@ -62,7 +62,7 @@ class Factory
6262
public function __construct(LoopInterface $loop = null, ConnectorInterface $connector = null)
6363
{
6464
$this->loop = $loop ?: Loop::get();
65-
$this->connector = $connector ?: new Connector($this->loop);
65+
$this->connector = $connector ?: new Connector(array(), $this->loop);
6666
}
6767

6868
/**

tests/FactoryTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use React\MySQL\ConnectionInterface;
66
use React\MySQL\Factory;
7-
use React\Socket\Server;
7+
use React\Socket\SocketServer;
88
use React\Promise\Promise;
99

1010
class FactoryTest extends BaseTestCase
@@ -140,13 +140,13 @@ public function testConnectWillRejectWhenServerClosesConnection()
140140
$loop = \React\EventLoop\Factory::create();
141141
$factory = new Factory($loop);
142142

143-
$server = new Server(0, $loop);
144-
$server->on('connection', function ($connection) use ($server) {
145-
$server->close();
143+
$socket = new SocketServer('127.0.0.1:0', array(), $loop);
144+
$socket->on('connection', function ($connection) use ($socket) {
145+
$socket->close();
146146
$connection->close();
147147
});
148148

149-
$parts = parse_url($server->getAddress());
149+
$parts = parse_url($socket->getAddress());
150150
$uri = $this->getConnectionString(array('host' => $parts['host'], 'port' => $parts['port']));
151151

152152
$promise = $factory->createConnection($uri);

0 commit comments

Comments
 (0)