-
-
Save cordoval/1236835 to your computer and use it in GitHub Desktop.
Could not establish connection: Connection refused (111)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Behat/Mink/Driver/Zombie/Connection.php b/src/Behat/Mink/Driver/Zombie/Connection.php | |
index 3c3d7c3..5e3627e 100644 | |
--- a/src/Behat/Mink/Driver/Zombie/Connection.php | |
+++ b/src/Behat/Mink/Driver/Zombie/Connection.php | |
@@ -27,6 +27,11 @@ class Connection | |
* @var integer | |
*/ | |
private $port = null; | |
+ | |
+ /** | |
+ * @var integer | |
+ */ | |
+ private $retries = 10; | |
/** | |
* Initializes connection instance. | |
@@ -100,6 +105,11 @@ class Connection | |
{ | |
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | |
if (false === @socket_connect($socket, $this->host, $this->port)) { | |
+ usleep(10000); | |
+ $this->retries--; | |
+ if ($this->retries > 0) { | |
+ $this->socketSend($js); | |
+ } | |
$errno = socket_last_error(); | |
throw new \RuntimeException( | |
sprintf("Could not establish connection: %s (%s)", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment