/** * {@inheritdoc} */ public function release(EasyHandle $easy) { if (!is_null($easy->response)) { $easy->response->curlInfo = curl_getinfo($easy->handle); } return parent::release($easy); }
public function testClosesIdleHandles() { $f = new Handler\CurlFactory(3); $req = new Psr7\Request('GET', Server::$url); $easy = $f->create($req, []); $h1 = $easy->handle; $f->release($easy); $this->assertCount(1, $this->readAttribute($f, 'handles')); $easy = $f->create($req, []); $this->assertSame($easy->handle, $h1); $easy2 = $f->create($req, []); $easy3 = $f->create($req, []); $easy4 = $f->create($req, []); $f->release($easy); $this->assertCount(1, $this->readAttribute($f, 'handles')); $f->release($easy2); $this->assertCount(2, $this->readAttribute($f, 'handles')); $f->release($easy3); $this->assertCount(3, $this->readAttribute($f, 'handles')); $f->release($easy4); $this->assertCount(3, $this->readAttribute($f, 'handles')); }