Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 40c6cf0

Browse files
committed
Merge pull request repejota#48 from dfeyer/task-respect-timeout
TASK: Respect connection timeout on reconnect
2 parents 1bd1289 + e353b76 commit 40c6cf0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Connection.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ public function getSubscriptions()
9191
*/
9292
private $options = null;
9393

94+
/**
95+
* Connection timeout
96+
*
97+
* @var integer
98+
*/
99+
private $timeout = null;
100+
94101
/**
95102
* Stream File Pointer.
96103
*
@@ -213,6 +220,7 @@ public function isConnected()
213220
*/
214221
public function connect($timeout = null)
215222
{
223+
$this->timeout = $timeout;
216224
$this->streamSocket = $this->getStream($this->options->getAddress(), $timeout);
217225
$msg = 'CONNECT '.$this->options;
218226
$this->send($msg);
@@ -441,7 +449,7 @@ public function reconnect()
441449
{
442450
$this->reconnects += 1;
443451
$this->close();
444-
$this->connect();
452+
$this->connect($this->timeout);
445453
}
446454

447455
/**

0 commit comments

Comments
 (0)