Forward-compatibility with future Socket v1.0 and Socket v0.8
Socket v0.8 only contains some minor breaking changes, which can be circumvented by ignoring URI schemes here. Future Socket v1.0 will not contain any BC breaks, so it's actually compatible with the last release.
This commit is contained in:
parent
e3a97b6661
commit
a86be3c526
@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
, "require": {
|
, "require": {
|
||||||
"php": ">=5.3.9"
|
"php": ">=5.3.9"
|
||||||
, "react/socket": "^0.7 || ^0.6 || ^0.5"
|
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
|
||||||
, "guzzle/http": "^3.6"
|
, "guzzle/http": "^3.6"
|
||||||
, "symfony/http-foundation": "^2.2|^3.0"
|
, "symfony/http-foundation": "^2.2|^3.0"
|
||||||
, "symfony/routing": "^2.2|^3.0"
|
, "symfony/routing": "^2.2|^3.0"
|
||||||
|
@ -89,10 +89,11 @@ class IoServer {
|
|||||||
*/
|
*/
|
||||||
public function handleConnect($conn) {
|
public function handleConnect($conn) {
|
||||||
$conn->decor = new IoConnection($conn);
|
$conn->decor = new IoConnection($conn);
|
||||||
|
|
||||||
$conn->decor->resourceId = (int)$conn->stream;
|
$conn->decor->resourceId = (int)$conn->stream;
|
||||||
|
|
||||||
|
$uri = $conn->getRemoteAddress();
|
||||||
$conn->decor->remoteAddress = trim(
|
$conn->decor->remoteAddress = trim(
|
||||||
parse_url('tcp://' . $conn->getRemoteAddress(), PHP_URL_HOST),
|
parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_HOST),
|
||||||
'[]'
|
'[]'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$loop = new StreamSelectLoop;
|
$loop = new StreamSelectLoop;
|
||||||
$this->reactor = new Server(0, $loop);
|
$this->reactor = new Server(0, $loop);
|
||||||
|
|
||||||
$this->port = parse_url('tcp://' . $this->reactor->getAddress(), PHP_URL_PORT);
|
$uri = $this->reactor->getAddress();
|
||||||
|
$this->port = parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_PORT);
|
||||||
$this->server = new IoServer($this->app, $this->reactor, $loop);
|
$this->server = new IoServer($this->app, $this->reactor, $loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user