|
@@ -26,7 +26,7 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
/**
|
|
/**
|
|
|
* Emitted when socket connection is successfully established.
|
|
* Emitted when socket connection is successfully established.
|
|
|
*
|
|
*
|
|
|
- * @var callable
|
|
|
|
|
|
|
+ * @var callable|null
|
|
|
*/
|
|
*/
|
|
|
public $onConnect = null;
|
|
public $onConnect = null;
|
|
|
|
|
|
|
@@ -61,7 +61,7 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
/**
|
|
/**
|
|
|
* Connect start time.
|
|
* Connect start time.
|
|
|
*
|
|
*
|
|
|
- * @var string
|
|
|
|
|
|
|
+ * @var float
|
|
|
*/
|
|
*/
|
|
|
protected $_connectStartTime = 0;
|
|
protected $_connectStartTime = 0;
|
|
|
|
|
|
|
@@ -109,7 +109,7 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
* @param array $context_option
|
|
* @param array $context_option
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
- public function __construct($remote_address, array $context_option = null)
|
|
|
|
|
|
|
+ public function __construct($remote_address, array $context_option = array())
|
|
|
{
|
|
{
|
|
|
$address_info = \parse_url($remote_address);
|
|
$address_info = \parse_url($remote_address);
|
|
|
if (!$address_info) {
|
|
if (!$address_info) {
|
|
@@ -303,7 +303,7 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
// Check socket state.
|
|
// Check socket state.
|
|
|
if ($address = \stream_socket_get_name($this->_socket, true)) {
|
|
if ($address = \stream_socket_get_name($this->_socket, true)) {
|
|
|
// Nonblocking.
|
|
// Nonblocking.
|
|
|
- \stream_set_blocking($this->_socket, 0);
|
|
|
|
|
|
|
+ \stream_set_blocking($this->_socket, false);
|
|
|
// Compatible with hhvm
|
|
// Compatible with hhvm
|
|
|
if (\function_exists('stream_set_read_buffer')) {
|
|
if (\function_exists('stream_set_read_buffer')) {
|
|
|
\stream_set_read_buffer($this->_socket, 0);
|
|
\stream_set_read_buffer($this->_socket, 0);
|