info() public static méthode

public static info ( $msg )
Exemple #1
0
function on_auth_success_callback()
{
    global $xmpp;
    JAXLLogger::info("got on_auth_success cb, jid " . $xmpp->full_jid->to_string());
}
Exemple #2
0
function delete_event($request, $pk)
{
    JAXLLogger::info("got event delete request for {$pk}");
    $request->close();
}
Exemple #3
0
function on_disconnect_callback()
{
    JAXLLogger::info("got on_disconnect cb");
}
Exemple #4
0
function on_auth_failure_callback($reason)
{
    global $client;
    $client->send_end_stream();
    JAXLLogger::info("got on_auth_failure cb with reason {$reason}");
}
Exemple #5
0
function on_request($client, $raw)
{
    global $server;
    $server->send($client, $raw);
    JAXLLogger::info("got client callback " . $raw);
}
Exemple #6
0
 public function __destruct()
 {
     JAXLLogger::info("shutting down socket server");
 }
Exemple #7
0
function on_disconnect_callback()
{
    global $form;
    JAXLLogger::info("registration " . ($form['type'] == 'result' ? 'succeeded' : 'failed'));
}
Exemple #8
0
 public function on_request($sock, $raw)
 {
     JAXLLogger::debug("on_request for client#{$sock}");
     $request = $this->requests[$sock];
     // 'wait_for_body' state is reached when ever
     // application calls recv_body() method
     // on received $request object
     if ($request->state() == 'wait_for_body') {
         $request->body($raw);
     } else {
         // break on crlf
         $lines = explode(HTTP_CRLF, $raw);
         // parse request line
         if ($request->state() == 'wait_for_request_line') {
             list($method, $resource, $version) = explode(" ", $lines[0]);
             $request->line($method, $resource, $version);
             unset($lines[0]);
             JAXLLogger::info($request->ip . " " . $request->method . " " . $request->resource . " " . $request->version);
         }
         // parse headers
         foreach ($lines as $line) {
             $line_parts = explode(":", $line);
             if (count($line_parts) > 1) {
                 if (strlen($line_parts[0]) > 0) {
                     $k = $line_parts[0];
                     unset($line_parts[0]);
                     $v = implode(":", $line_parts);
                     $request->set_header($k, $v);
                 }
             } elseif (strlen(trim($line_parts[0])) == 0) {
                 $request->empty_line();
             } else {
                 // if exploded line array size is 1
                 // and there is something in $line_parts[0]
                 // must be request body
                 $request->body($line);
             }
         }
     }
     // if request has reached 'headers_received' state?
     if ($request->state() == 'headers_received') {
         // dispatch to any matching rule found
         JAXLLogger::debug("delegating to dispatcher for further routing");
         $dispatched = $this->dispatcher->dispatch($request);
         // if no dispatch rule matched call generic callback
         if (!$dispatched && $this->cb) {
             JAXLLogger::debug("no dispatch rule matched, sending to generic callback");
             call_user_func($this->cb, $request);
         } elseif (!$dispatched) {
             // elseif not dispatched and not generic callbacked
             // send 404 not_found
             // TODO: send 404 if no callback is registered for this request
             JAXLLogger::debug("dropping request since no matching dispatch rule or generic callback was specified");
             $request->not_found('404 Not Found');
         }
     } else {
         // if state is not 'headers_received'
         // reactivate client socket for read event
         $this->server->read($sock);
     }
 }
Exemple #9
0
 public function retry()
 {
     $retry_after = pow(2, $this->retry_attempt) * $this->retry_interval;
     $this->retry_attempt++;
     JAXLLogger::info("Will try to restart in " . $retry_after . " seconds");
     // TODO: use jaxl cron if sigalarms cannnot be used
     sleep($retry_after);
     $this->start();
 }
Exemple #10
0
 /**
  * @param string | resource $socket_path
  */
 public function connect($socket_path)
 {
     if (gettype($socket_path) == "string") {
         $path_parts = explode(":", $socket_path);
         $this->transport = $path_parts[0];
         $this->host = substr($path_parts[1], 2, strlen($path_parts[1]));
         if (count($path_parts) == 3) {
             $this->port = $path_parts[2];
         }
         JAXLLogger::info("trying " . $socket_path);
         if ($this->stream_context) {
             $this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->stream_context);
         } else {
             $this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout);
         }
     } elseif (is_resource($socket_path)) {
         $this->fd =& $socket_path;
     } else {
         // Some error occurred.
     }
     if ($this->fd) {
         JAXLLogger::debug("connected to " . $socket_path . "");
         stream_set_blocking($this->fd, $this->blocking);
         // watch descriptor for read/write events
         JAXLLoop::watch($this->fd, array('read' => array(&$this, 'on_read_ready')));
         return true;
     } else {
         JAXLLogger::error(sprintf("unable to connect %s with error no: %s, error str: %s", is_null($socket_path) ? 'NULL' : $socket_path, is_null($this->errno) ? 'NULL' : $this->errno, is_null($this->errstr) ? 'NULL' : $this->errstr));
         $this->disconnect();
         return false;
     }
 }
Exemple #11
0
function read_event_callback($data)
{
    global $pipe;
    JAXLLogger::info("read " . trim($data) . " from pipe");
}
Exemple #12
0
 public function __destruct()
 {
     JAXLLogger::info("shutting down clock server...");
 }
Exemple #13
0
function on_disconnect($client)
{
    JAXLLogger::info("got on_disconnect cb");
}