Пример #1
0
                        if (!preg_match('/chat_message=([^&]*)[& ]chat_msgidnr=([^&]*)[& ]/', $data, $info)) {
                            $DAEMON->trace('Message sidekick did not contain a valid message', E_USER_WARNING);
                            $DAEMON->dismiss_ufo($handle, true, 'Request with malformed data; connection closed');
                            continue;
                        } else {
                            $customdata = array('message' => $info[1], 'index' => $info[2]);
                        }
                        break;
                    default:
                        $DAEMON->trace('UFO with ' . $handle . ': Request with unknown type; connection closed', E_USER_WARNING);
                        $DAEMON->dismiss_ufo($handle, true, 'Request with unknown type; connection closed');
                        continue;
                        break;
                }
                // OK, now we know it's something good... promote it and pass it all the data it needs
                $DAEMON->promote_ufo($handle, $type, $sessionid, $customdata);
                continue;
            }
        }
    }
    $now = time();
    // Clean up chatrooms with no activity as required
    if ($now - $DAEMON->_last_idle_poll >= $DAEMON->_freq_poll_idle_chat) {
        $DAEMON->poll_idle_chats($now);
    }
    // Finally, accept new connections
    $DAEMON->conn_accept();
    usleep($DAEMON->_time_rest_socket);
}
@socket_shutdown($DAEMON->listen_socket, 0);
die("\n\n-- terminated --\n");
Пример #2
0
                        if (!preg_match('/chat_message=([^&]*)[& ]chat_msgidnr=([^&]*)[& ]/', $data, $info)) {
                            $daemon->trace('Message sidekick did not contain a valid message', E_USER_WARNING);
                            $daemon->dismiss_ufo($handle, true, 'Request with malformed data; connection closed');
                            continue;
                        } else {
                            $customdata = array('message' => $info[1], 'index' => $info[2]);
                        }
                        break;
                    default:
                        $daemon->trace('UFO with ' . $handle . ': Request with unknown type; connection closed', E_USER_WARNING);
                        $daemon->dismiss_ufo($handle, true, 'Request with unknown type; connection closed');
                        continue;
                        break;
                }
                // OK, now we know it's something good. Promote it and pass it all the data it needs.
                $daemon->promote_ufo($handle, $type, $sessionid, $customdata);
                continue;
            }
        }
    }
    $now = time();
    // Clean up chatrooms with no activity as required.
    if ($now - $daemon->_last_idle_poll >= $daemon->_freq_poll_idle_chat) {
        $daemon->poll_idle_chats($now);
    }
    // Finally, accept new connections.
    $daemon->conn_accept();
    usleep($daemon->_time_rest_socket);
}
@socket_shutdown($daemon->listen_socket, 0);
die("\n\n-- terminated --\n");