Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Close connection on error
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Dec 5, 2018
1 parent 2760b64 commit 45459e2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Client.php
Expand Up @@ -60,7 +60,9 @@ public function log(Request $request, Response $response)
{
@trigger_error('log() is deprecated since version 0.2 and will be removed in 0.3. Use request(new LogCommand()) instead.', E_USER_DEPRECATED);

return $this->request(new LogCommand($request, $response));
$this->request(new LogCommand($request, $response));

return true;
}

public function request(Command\CommandInterface $command)
Expand Down Expand Up @@ -90,6 +92,7 @@ private function doRequest(Command\CommandInterface $command)

--$this->connections[$this->currentConnectionName]['retries'];
$this->currentConnection = null;
$this->box('disconnect', null, [$connection]);

return $this->doRequest($command);
}
Expand All @@ -108,6 +111,7 @@ private function doRequest(Command\CommandInterface $command)

--$this->connections[$this->currentConnectionName]['retries'];
$this->currentConnection = null;
$this->box('disconnect', null, [$connection]);

return $this->doRequest($command);
}
Expand Down Expand Up @@ -175,6 +179,11 @@ private function doConnect($options)
);
}

private function disconnect($connection)
{
fclose($connection);
}

private function doSend($connection, $content)
{
return $this->fwrite($connection, $content);
Expand Down

0 comments on commit 45459e2

Please sign in to comment.