本文整理汇总了PHP中event_del函数的典型用法代码示例。如果您正苦于以下问题:PHP event_del函数的具体用法?PHP event_del怎么用?PHP event_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了event_del函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* Free from loop
*/
public function __destruct()
{
if (!empty($this->event)) {
event_del($this->event);
event_free($this->event);
unset($this->event);
}
}
示例2: removeSignal
/**
* Remove signal handler.
*
* @param $signal
*/
public function removeSignal($signal)
{
if (isset($this->_signalEvents[$signal])) {
$event = $this->_signalEvents[$signal];
event_del($event);
unset($this->_signalEvents[$signal]);
}
}
示例3: close
/**
* 关闭socket
* @param $socket
* @param $event
* @return unknown_type
*/
static function close($socket, $event = null)
{
if ($event) {
event_del($event);
event_free($event);
}
fclose($socket);
}
示例4: removeStream
public function removeStream($stream)
{
if (isset($this->events[(int) $stream])) {
$event = $this->events[(int) $stream];
event_del($event);
event_free($event);
unset($this->events[(int) $stream]);
}
}
示例5: close
public function close()
{
$this->log("close()");
foreach (array_keys($this->clients) as $id) {
$this->disconnectClient($id);
}
$this->clients = array();
stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR);
event_del($this->socket_event);
event_free($this->socket_event);
$this->socket_event = null;
}
示例6: service
private function service($connection, $flag, $base)
{
$connectionId = $this->getIdByConnection($connection);
$buffer = event_buffer_new($connection, array($this, 'onRead'), array($this, 'onWrite'), array($this, 'onError'), $connectionId);
event_buffer_base_set($buffer, $this->base);
event_buffer_watermark_set($buffer, EV_READ, 0, 0xffffff);
event_buffer_priority_set($buffer, 10);
event_buffer_enable($buffer, EV_READ | EV_WRITE | EV_PERSIST);
$this->buffers[$connectionId] = $buffer;
event_del($this->events[$connectionId]);
event_free($this->events[$connectionId]);
unset($this->events[$connectionId]);
}
示例7: onRead
public function onRead($socket, $event, $args)
{
while ($chunk = fread($socket, 4096)) {
$this->response .= $chunk;
}
if (feof($socket)) {
fclose($socket);
event_del($args[0]);
if ($this->config['callback']) {
call_user_func($this->config['callback'], array('response' => $this->response));
}
}
}
示例8: onRequest
public function onRequest($clientSocket, $events, $arg)
{
try {
//$transport = new TBufferedTransport(new TNonblockingSocket($clientSocket));
$transport = new TNonblockingSocket($clientSocket);
call_user_func($this->callback, $transport);
} catch (Exception $e) {
\event_del($arg[0]);
\event_free($arg[0]);
// close socket
@stream_socket_shutdown($clientSocket, STREAM_SHUT_RDWR);
@fclose($clientSocket);
return;
}
}
示例9: __destruct
/**
* Free from loop and close the stream
*/
public function __destruct()
{
if (!empty($this->ev_read)) {
event_del($this->ev_read);
event_free($this->ev_read);
unset($this->ev_read);
}
if (!empty($this->ev_write)) {
event_del($this->ev_write);
event_free($this->ev_write);
unset($this->ev_write);
}
if (!empty($this->stream)) {
fclose($this->stream);
unset($this->stream);
}
}
示例10: sw_socket_close
/**
* 关闭socket
* @param $socket
* @param $event
* @return unknown_type
*/
function sw_socket_close($socket, $event = null)
{
if ($event) {
event_del($event);
event_free($event);
}
stream_socket_shutdown($socket, STREAM_SHUT_RDWR);
fclose($socket);
}
示例11: closeConnection
public function closeConnection($connId)
{
if (Daemon::$settings['logevents']) {
Daemon::log('[WORKER ' . Daemon::$worker->pid . '] closeConnection(' . $connId . ').');
}
if (!isset($this->buf[$connId])) {
return;
}
if (isset($this->readEvents[$connId])) {
event_del($this->readEvents[$connId]);
event_free($this->readEvents[$connId]);
unset($this->readEvents[$connId]);
}
event_buffer_free($this->buf[$connId]);
if (Daemon::$useSockets) {
socket_close(Daemon::$worker->pool[$connId]);
} else {
fclose(Daemon::$worker->pool[$connId]);
}
unset(Daemon::$worker->pool[$connId]);
unset(Daemon::$worker->poolApp[$connId]);
unset(Daemon::$worker->readPoolState[$connId]);
unset($this->buf[$connId]);
unset($this->poolQueue[$connId]);
unset(Daemon::$worker->poolState[$connId]);
}
示例12: cancelTimer
public function cancelTimer($signature)
{
if (isset($this->timers[$signature])) {
$timer = $this->timers[$signature];
$timer->cancelled = true;
event_del($timer->resource);
event_free($timer->resource);
unset($this->timers[$signature]);
}
}
示例13: removeStream
public function removeStream($stream)
{
$id = (int) $stream;
if (isset($this->events[$id])) {
$event = $this->events[$id];
unset($this->events[$id], $this->flags[$id], $this->readCallbacks[$id], $this->writeCallbacks[$id]);
event_del($event);
event_free($event);
}
}
示例14: disable
/**
* Disable all events of sockets
* @return void
*/
public function disable()
{
return;
// possible critical bug
for (; sizeof($this->socketEvents);) {
if (!is_resource($ev = array_pop($this->socketEvents))) {
continue;
}
event_del($ev);
event_free($ev);
}
}
示例15: remove
function remove($event)
{
$ev = $event->handle;
event_del($ev);
return $this;
}