Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react/socket to v0.8.0 #21

Merged
merged 3 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"license": "MIT",
"require": {
"php": ">=5.4.0",
"react/socket": "0.4.*",
"react/dns": "0.4.*",
"react/socket-client": "0.4.*"
"react/socket": "0.8.*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per reactphp/socket#75, you may as well target future versions with ^1.0 || ^0.8 here 👍

"react/dns": "0.4.*"
},
"require-dev": {
"phpunit/dbunit": ">=1.2"
Expand Down
9 changes: 4 additions & 5 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

use React\EventLoop\LoopInterface;
use React\Stream\Stream;
use React\MySQL\Connector;
use React\Socket\Connector;
use React\MySQL\Commands\AuthenticateCommand;
use React\MySQL\Commands\PingCommand;
use React\MySQL\Commands\QueryCommand;
use React\MySQL\Commands\QuitCommand;
use React\Socket\ConnectionException;

class Connection extends EventEmitter
{
Expand Down Expand Up @@ -52,7 +51,7 @@ public function __construct(LoopInterface $loop, array $connectOptions = array()
{
$this->loop = $loop;
$resolver = (new \React\Dns\Resolver\Factory())->createCached('8.8.8.8', $loop);
$this->connector = new Connector($loop, $resolver);;
$this->connector = new Connector($loop, ['dns' => $resolver]);
$this->executor = new Executor($this);
$this->options = $connectOptions + $this->options;
}
Expand Down Expand Up @@ -191,7 +190,7 @@ public function connect()
};

$this->connector
->create($this->options['host'], $this->options['port'])
->connect($this->options['host'] . ':' . $this->options['port'])
->then(function ($stream) use (&$streamRef, $options, $errorHandler, $connectedHandler) {
$streamRef = $stream;

Expand Down Expand Up @@ -224,7 +223,7 @@ public function handleConnectionClosed()
{
if ($this->state < self::STATE_CLOSEING) {
$this->state = self::STATE_CLOSED;
$this->emit('error', [new ConnectionException('mysql server has gone away'), $this]);
$this->emit('error', [new \RuntimeException('mysql server has gone away'), $this]);
}
}

Expand Down
24 changes: 0 additions & 24 deletions src/Connector.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Protocal/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function setOptions($options)
}
}

public function parse($data, $stream)
public function parse($data)
{
$this->append($data);
packet:
Expand Down