| @@ 315-327 (lines=13) @@ | ||
| 312 | /** |
|
| 313 | * @param \Exception $error |
|
| 314 | */ |
|
| 315 | protected function onError(\Exception $error) |
|
| 316 | { |
|
| 317 | if ($this->requestTimer !== null && $this->loop->isTimerActive($this->requestTimer)) { |
|
| 318 | $this->loop->cancelTimer($this->requestTimer); |
|
| 319 | } |
|
| 320 | ||
| 321 | if ($this->connectionTimer !== null && $this->loop->isTimerActive($this->connectionTimer)) { |
|
| 322 | $this->loop->cancelTimer($this->connectionTimer); |
|
| 323 | } |
|
| 324 | ||
| 325 | $this->error = $error; |
|
| 326 | $this->deferred->reject($this->error); |
|
| 327 | } |
|
| 328 | ||
| 329 | /** |
|
| 330 | * |
|
| @@ 332-347 (lines=16) @@ | ||
| 329 | /** |
|
| 330 | * |
|
| 331 | */ |
|
| 332 | protected function onEnd() |
|
| 333 | { |
|
| 334 | if ($this->requestTimer !== null && $this->loop->isTimerActive($this->requestTimer)) { |
|
| 335 | $this->loop->cancelTimer($this->requestTimer); |
|
| 336 | } |
|
| 337 | ||
| 338 | if ($this->connectionTimer !== null && $this->loop->isTimerActive($this->connectionTimer)) { |
|
| 339 | $this->loop->cancelTimer($this->connectionTimer); |
|
| 340 | } |
|
| 341 | ||
| 342 | $this->loop->futureTick(function () { |
|
| 343 | if ($this->httpResponse === null) { |
|
| 344 | $this->deferred->reject($this->error); |
|
| 345 | } |
|
| 346 | }); |
|
| 347 | } |
|
| 348 | ||
| 349 | /** |
|
| 350 | * |
|