本文整理汇总了PHP中Dog::addServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::addServer方法的具体用法?PHP Dog::addServer怎么用?PHP Dog::addServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::addServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init(Dog_WorkerThread $worker)
{
Dog::setWorker($worker);
Dog_Lang::init();
self::initModules();
foreach (Dog_Server::getAllServers() as $server) {
$server instanceof Dog_Server;
if ($server->isActive()) {
Dog::addServer($server);
}
}
Dog_Timer::init(self::getSleepMillis());
Dog_Timer::addTimer(array(__CLASS__, 'initTimers'), NULL, count(Dog::getServers()) * Dog::CONNECT_WAIT + 1, false);
Dog_Timer::addTimer(array('Dog', 'botReady'), NULL, count(Dog::getServers()) * Dog::CONNECT_WAIT + 2, false);
self::$STARTUP_TIME = microtime(true);
return true;
}
示例2: parse_url
$prot = $server->isSSL() ? 'ircs' : 'irc';
$port = $server->getPort();
} else {
$url = parse_url($argv[0]);
if (!isset($url['host'])) {
return $plugin->rply('err_url');
}
$host = $url['host'];
$prot = isset($url['scheme']) ? strtolower($url['scheme']) : 'irc';
if ($prot !== 'irc' && $prot !== 'ircs') {
return $plugin->rply('err_url');
}
$default_port = $prot === 'ircs' ? 6697 : 6667;
$port = isset($url['port']) ? intval($url['port']) : $default_port;
$options = Dog_Server::DEFAULT_OPTIONS;
$options |= $prot === 'ircs' ? Dog_Server::SSL : 0;
}
if (false !== ($server = Dog::getServerByArg($argv[0])) || false !== ($server = Dog::getServerByArg($host))) {
$plugin->reply('reconnecting');
$server->saveOption(Dog_Server::ACTIVE, true);
$server->saveOption(Dog_Server::SSL, $prot === 'ircs');
$server->saveVar('serv_port', $port);
} else {
$plugin->reply('adding_server');
$server = Dog_Server::getOrCreate($host, $port, $options);
$server->setVar('dog_connector', Dog::getUser());
$server->setConf('ircoppass', GWF_Random::randomKey(8));
Dog::addServer($server);
}
$server->setConnectIn(0.5);
$plugin->rply('connect');