Exemple #1
0
 public function ev_error($listener, $ctx)
 {
     $errno = EventUtil::getLastSocketErrno();
     fprintf(STDERR, "Got an error %d (%s) on the listener. Shutting down.\n", $errno, EventUtil::getLastSocketError());
     if ($errno != 0) {
         $this->base->exit(NULL);
         exit;
     }
 }
Exemple #2
0
 public function echoEventCallback($bev, $events, $ctx)
 {
     if ($events & EventBufferEvent::ERROR) {
         echo "Error from bufferevent\n";
     }
     if ($events & (EventBufferEvent::EOF | EventBufferEvent::ERROR)) {
         $bev->free();
         $error_no = EventUtil::getLastSocketErrno();
         $error_msg = EventUtil::getLastSocketError();
         $log = "line: " . __LINE__ . ", {$error_msg} ({$error_no})";
         var_dump($log);
     }
 }
Exemple #3
0
 /**
  * Called when the connection state changed
  * @param  object  $bev    EventBufferEvent
  * @param  integer $events Events
  * @return void
  */
 public function onStateEv($bev, $events)
 {
     if ($events & \EventBufferEvent::CONNECTED) {
         $this->onWriteEv($bev);
     } elseif ($events & (\EventBufferEvent::ERROR | \EventBufferEvent::EOF | \EventBufferEvent::TIMEOUT)) {
         try {
             if ($this->finished) {
                 return;
             }
             if ($events & \EventBufferEvent::ERROR) {
                 $errno = \EventUtil::getLastSocketErrno();
                 if ($errno !== 0) {
                     $this->log('Socket error #' . $errno . ':' . \EventUtil::getLastSocketError());
                 }
                 if ($this->ssl && $this->bev) {
                     while ($err = $this->bev->sslError()) {
                         $this->log('EventBufferEvent SSL error: ' . $err);
                     }
                 }
             }
             $this->finished = true;
             $this->onFinish();
             $this->close();
         } catch (\Exception $e) {
             Daemon::uncaughtExceptionHandler($e);
         }
     }
 }
Exemple #4
0
 /**
  * callback_accept_error 
  * 
  * @param mixed $listener 
  * @access public
  * @return void
  */
 public function callback_accept_error($listener)
 {
     $error_no = \EventUtil::getLastSocketErrno();
     $error_msg = \EventUtil::getLastSocketError();
     $log = "listener accept error, {$error_msg} ({$error_no})";
     $this->log($log, LOG_WARNING);
 }
Exemple #5
0
function callback_accept_error($listener, $base)
{
    echo "accept error running...\n";
    fprintf(STDOUT, "Got an error %d (%s) on the listener. Shutting down.\n", EventUtil::getLastSocketErrno(), EventUtil::getLastSocketError());
    $base->exit();
}
Exemple #6
0
 public function accept_error_cb($listener, $ctx)
 {
     $base = $this->base;
     fprintf(STDERR, "Got an error %d (%s) on the listener. " . "Shutting down.\n", EventUtil::getLastSocketErrno(), EventUtil::getLastSocketError());
     $base->exit(NULL);
 }