#742 create new context for socket connection (#743)

Co-authored-by: Ondřej Ešler <ondrej.esler@peoplepath.com>
This commit is contained in:
Ondřej Ešler
2022-02-04 17:41:14 +01:00
committed by GitHub
parent 90496e76b5
commit ed19ec3483
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -123,8 +123,9 @@ class PhpiredisStreamConnection extends StreamConnection
{
$socket = null;
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
$context = stream_context_create();
$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags);
$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags, $context);
if (!$resource) {
$this->onConnectionError(trim($errstr), $errno);
+2 -1
View File
@@ -123,8 +123,9 @@ class StreamConnection extends AbstractConnection
protected function createStreamSocket(ParametersInterface $parameters, $address, $flags)
{
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0);
$context = stream_context_create();
if (!$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags)) {
if (!$resource = @stream_socket_client($address, $errno, $errstr, $timeout, $flags, $context)) {
$this->onConnectionError(trim($errstr), $errno);
}