Last active
April 6, 2017 12:36
-
-
Save clue/75d00d9c2ca2e931661c to your computer and use it in GitHub Desktop.
TimeoutConnector skeleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace React\SocketClient; | |
use React\SocketClient\ConnectorInterface; | |
use React\EventLoop\LoopInterface; | |
use React\Promise\Timer; | |
class TimeoutConnector implements ConnectorInterface | |
{ | |
public function __construct(ConnectorInterface $connector, $timeout, LoopInterface $loop) | |
{ | |
$this->connector = $connector; | |
$this->timeout = $timeout; | |
$this->loop = $loop; | |
} | |
public function create($host, $port) | |
{ | |
return Timer\timeout($this->connector->create($host, $port), $this->timeout, $this->loop); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment