/** * @TODO DESCR * @return void */ public function onReady() { if ($this->user === null) { $this->connected = true; } if ($this->connected) { parent::onReady(); return; } $this->dbname = $this->path; $this->pool->getNonce(['dbname' => $this->dbname], function ($result) { if (isset($result['$err'])) { Daemon::log('MongoClient: getNonce() error with ' . $this->url . ': ' . $result['$err']); $this->finish(); } $this->pool->auth(['user' => $this->user, 'password' => $this->password, 'nonce' => $result['nonce'], 'dbname' => $this->dbname], function ($result) { if (!isset($result['ok']) || !$result['ok']) { Daemon::log('MongoClient: authentication error with ' . $this->url . ': ' . $result['errmsg']); $this->finish(); return; } $this->connected = true; $this->onReady(); }, $this); }, $this); }
/** * @TODO DESCR * @return void */ public function onReady() { if ($this->user === null) { $this->connected = true; } if ($this->connected) { parent::onReady(); return; } $this->dbname = $this->path; $this->pool->sasl_scrum_sha1_auth(['user' => $this->user, 'password' => $this->password, 'dbname' => $this->dbname, 'conn' => $this], function ($result) { if (!isset($result['ok']) || !$result['ok']) { Daemon::log('MongoClient: authentication error with ' . $this->url . ': ' . $result['errmsg']); $this->finish(); return; } $this->connected = true; $this->onReady(); }, $this); }
/** * Called when the connection is handshaked (at low-level), and peer is ready to recv. data * @return void */ public function onReady() { $this->ptr =& $this->result; if (!isset($this->password)) { if (isset($this->pool->config->select->value)) { $this->select($this->pool->config->select->value); } parent::onReady(); $this->setWatermark(null, $this->pool->maxAllowedPacket + 2); return; } $this->sendCommand('AUTH', [$this->password], function () { if ($this->result !== 'OK') { $this->log('Auth. error: ' . json_encode($this->result)); $this->finish(); } if (isset($this->pool->config->select->value)) { $this->select($this->pool->config->select->value); } parent::onReady(); $this->setWatermark(null, $this->pool->maxAllowedPacket + 2); }); }
/** * Called when the connection is handshaked (at low-level), and peer is ready to recv. data * @return void */ public function onReady() { if (static::$requestCommandListFlipped === null) { static::$requestCommandListFlipped = array_flip(static::$requestCommandList); } if (static::$responseCommandListFlipped === null) { static::$responseCommandListFlipped = array_flip(static::$responseCommandList); } parent::onReady(); }
/** * Called when the connection is handshaked (at low-level), and peer is ready to recv. data * @return void */ public function onReady() { parent::onReady(); $this->setWatermark(null, $this->pool->maxAllowedPacket); }