Exemplo n.º 1
0
 public function reconnect()
 {
     $this->updateContext();
     try {
         $this->connectStartTime = time();
         $conn = new connection($this->getClientConf('server'), $this->getClientConf('port'), CONNECT_TIMEOUT);
         $this->conn = $conn;
         $conn->setSocketClass($this->socketClass);
         $conn->setIrcClass($this);
         $conn->setCallbackClass($this);
         $conn->setTimerClass($this->timerClass);
         $conn->init();
         if ($conn->getError()) {
             throw new ConnectException($conn->getErrorMsg());
         }
         //Bind socket...
         if ($this->getClientConf('bind') != "") {
             $conn->bind($this->getClientConf('bind'));
         }
         $this->sockInt = $conn->getSockInt();
         $conn->connect();
     } catch (ConnectException $e) {
         $this->beginReconnectTimer();
         $this->status = STATUS_ERROR;
         $this->exception = $e;
         return;
     }
     $this->status = STATUS_CONNECTING;
     $this->updateContext();
     return;
 }