aboutsummaryrefslogtreecommitdiff
path: root/src/callnotifier/Source/Remote.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2015-06-21 06:28:40 +0200
committerChristian Weiske <cweiske@cweiske.de>2015-06-21 06:28:40 +0200
commitbd72383ab1a5742d3ddc102fd3a1b0d4d7d9f2a1 (patch)
treecb78f5aa8bb4f8cf7248a7ef94d2686641a28e0a /src/callnotifier/Source/Remote.php
parente7dac6ad212a737aec0387d60f84c275c673cdc0 (diff)
downloadauerswald-callnotifier-bd72383ab1a5742d3ddc102fd3a1b0d4d7d9f2a1.tar.gz
auerswald-callnotifier-bd72383ab1a5742d3ddc102fd3a1b0d4d7d9f2a1.zip
try to handle nightly debug port resets
Diffstat (limited to 'src/callnotifier/Source/Remote.php')
-rw-r--r--src/callnotifier/Source/Remote.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/callnotifier/Source/Remote.php b/src/callnotifier/Source/Remote.php
index 39b042c..4145c59 100644
--- a/src/callnotifier/Source/Remote.php
+++ b/src/callnotifier/Source/Remote.php
@@ -13,9 +13,16 @@ class Source_Remote
public function run()
{
- $this->connect($this->config->host, $this->config->port);
- $this->init();
- $this->loop();
+ do {
+ try {
+ $tryAgain = false;
+ $this->connect($this->config->host, $this->config->port);
+ $this->init();
+ $this->loop();
+ } catch (\Exception_ConnectionReset $e) {
+ $tryAgain = true;
+ }
+ } while ($tryAgain);
$this->disconnect();
}
@@ -64,6 +71,11 @@ class Source_Remote
function read_response()
{
$res = socket_read($this->socket, 2048, PHP_NORMAL_READ);
+ if ($res === false) {
+ //handle "Connection reset by peer" that appears nightly since
+ // version 4.0N
+ throw new Exception_ConnectionReset();
+ }
return substr($res, 2, -1);
}