update workerman to 3.3.4

This commit is contained in:
walkor
2016-09-20 21:27:41 +08:00
parent a3d823d04a
commit 58dc935eb0
25 changed files with 4159 additions and 2500 deletions
+41 -26
View File
@@ -1,68 +1,83 @@
<?php
/**
* This file is part of workerman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Workerman\Connection;
use Workerman\Events\Libevent;
use Workerman\Events\Select;
use Workerman\Events\EventInterface;
use Workerman\Worker;
use \Exception;
/**
* connection类的接口
* @author walkor<walkor@workerman.net>
* ConnectionInterface.
*/
abstract class ConnectionInterface
{
/**
* status命令的统计数据
* Statistics for status command.
*
* @var array
*/
public static $statistics = array(
'connection_count'=>0,
'total_request' => 0,
'throw_exception' => 0,
'send_fail' => 0,
'connection_count' => 0,
'total_request' => 0,
'throw_exception' => 0,
'send_fail' => 0,
);
/**
* 当收到数据时,如果有设置$onMessage回调,则执行
* Emitted when data is received.
*
* @var callback
*/
public $onMessage = null;
/**
* 当连接关闭时,如果设置了$onClose回调,则执行
* Emitted when the other end of the socket sends a FIN packet.
*
* @var callback
*/
public $onClose = null;
/**
* 当出现错误时,如果设置了$onError回调,则执行
* Emitted when an error occurs with connection.
*
* @var callback
*/
public $onError = null;
/**
* 发送数据给对端
* Sends data on the connection.
*
* @param string $send_buffer
* @return void|boolean
*/
abstract public function send($send_buffer);
/**
* 获得远端ip
* Get remote IP.
*
* @return string
*/
abstract public function getRemoteIp();
/**
* 获得远端端口
* Get remote port.
*
* @return int
*/
abstract public function getRemotePort();
/**
* 关闭连接,为了保持接口一致,udp保留了此方法,当是udp时调用此方法无任何作用
* @void
* Close connection.
*
* @param $data
* @return void
*/
abstract public function close($data = null);
}