Skip to content

Instantly share code, notes, and snippets.

@cordoval
Forked from FireFoxIXI/Connection.diff
Created September 23, 2011 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cordoval/1236835 to your computer and use it in GitHub Desktop.
Save cordoval/1236835 to your computer and use it in GitHub Desktop.
Could not establish connection: Connection refused (111)
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