public function onConnected($cb)
 {
     $conn = $this;
     if ($conn->user !== NULL) {
         $this->pool->getNonce(array('dbname' => $conn->dbname), function ($result) use($conn) {
             $conn->appInstance->auth(array('user' => $conn->user, 'password' => $conn->password, 'nonce' => $result['nonce'], 'dbname' => $conn->dbname), function ($result) use($conn) {
                 if (!$result['ok']) {
                     Daemon::log('MongoClient: authentication error with ' . $conn->url . ': ' . $result['errmsg']);
                 }
             }, $conn);
         }, $conn);
     } else {
         parent::onConnected();
     }
 }
Beispiel #2
0
 public function onFinish()
 {
     if ($this->protocolError) {
         while (!$this->onResponse->isEmpty()) {
             call_user_func($this->onResponse->shift(), $this, false);
         }
     } else {
         if ($this->state !== self::STATE_ROOT && !$this->onResponse->isEmpty()) {
             $this->requestFinished();
         }
     }
     parent::onFinish();
 }