Skip to content

Commit

Permalink
Another try to catch timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogov Viktor committed Mar 4, 2015
1 parent 5dcf395 commit fd0fc04
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@ protected function _readResponse($expected, $prevException = null)

if (substr($response, 0, 3) != $expected) {
$type = gettype($response);
$msg = "Unexpected response {$type}:'{$response}'. ";
if (feof($this->_smtp)) {
$this->close();
$eof = 'EOF - true';
$msg .= 'EOF - true. ';
} else {
$eof = 'EOF - false';
$msg .= 'EOF - false. ';
if ($response == '') {
$msg .= 'Timeout? Reconnecting. ';
$this->close();
}
}
$msg = "Unexpected response {$type}:'{$response}'. {$eof}. Expected {$expected}. Here is the dialog dump:\n{$this->_log}";
$msg .= "Expected {$expected}. Here is the dialog dump:\n{$this->_log}";
throw new Exception($msg, 0, $prevException);
}

Expand Down

0 comments on commit fd0fc04

Please sign in to comment.