/** * Retrieves a curl connection to use. * * @ignore * @param string $Host * @return resource Locked resource. <code>FALSE</code> */ private function _lock($Host) { // Is current request rate too high if ($this->_Helper->getRate() >= floatval($this->_MaxRate)) { return false; // Are connections to host maxed out? } elseif ($this->_Helper->getConnections($Host) >= $this->_MaxConnections) { return false; } else { // Return free handle if any exists return $this->_Helper->getFreeHandle(); } }
/** * @covers ::getConnections */ public function test_getConnections() { $this->assertSame(0, $this->Helper->getConnections('foo.com'), 'Helper::getConnections() should return 0'); $this->Helper->Stats['HostConnections']['foo.com'] = array(1, 2, 3, 4); $this->assertSame(4, $this->Helper->getConnections('foo.com'), 'Helper::getConnections() should return 4'); }