|
|
@@ -106,11 +106,11 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
*/
|
|
|
public function checkConnection($socket)
|
|
|
{
|
|
|
- // 删除连接可写监听
|
|
|
- Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
|
|
|
// 需要判断两次连接是否已经断开
|
|
|
if(!feof($this->_socket) && !feof($this->_socket) && is_resource($this->_socket))
|
|
|
{
|
|
|
+ // 删除连接可写监听
|
|
|
+ Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
|
|
|
// 设置非阻塞
|
|
|
stream_set_blocking($this->_socket, 0);
|
|
|
// 监听可读事件
|
|
|
@@ -138,11 +138,12 @@ class AsyncTcpConnection extends TcpConnection
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $this->_status = self::STATUS_CLOSED;
|
|
|
- // 关闭socket
|
|
|
- @fclose($this->_socket);
|
|
|
// 连接未建立成功
|
|
|
$this->emitError(WORKERMAN_CONNECT_FAIL, 'connect fail');
|
|
|
+ // 触发onClsoe
|
|
|
+ $this->destroy();
|
|
|
+ // 清理onConnect回调
|
|
|
+ $this->onConnect = null;
|
|
|
}
|
|
|
}
|
|
|
}
|