Remove a curl handle from the curl multi object
Nasty things (bus errors, segmentation faults) can sometimes occur when removing curl handles when in a callback or a recursive scope. Here we are queueing all curl handles that need to be removed and closed so that this happens only in the outermost scope when everything has completed sending.
RequestInterface $request Request that owns the handle:
protected function removeHandle(RequestInterface $request) {
if ($this->handles
->contains($request)) {
$handle = $this->handles[$request];
unset($this->resourceHash[(int) $handle
->getHandle()]);
unset($this->handles[$request]);
$this->removeHandles[] = $handle;
}
}