Skip to content

Commit

Permalink
Fixed issue where data could potentially be lost if it was read just …
Browse files Browse the repository at this point in the history
…as the timeout expired.
  • Loading branch information
SamMousa committed Sep 19, 2018
1 parent a48ccdc commit 57b6e76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ pheanstalk.phar

# Composer installs dependencies here.
vendor/

.idea
tests/coverage
2 changes: 1 addition & 1 deletion src/Pheanstalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class Pheanstalk implements PheanstalkInterface
{
const VERSION = '3.1.1';
const VERSION = '3.2.1';

private $_connection;
private $_using = PheanstalkInterface::DEFAULT_TUBE;
Expand Down
2 changes: 1 addition & 1 deletion src/Socket/NativeSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getLine($length = null)
if ($this->_wrapper()->feof($this->_socket)) {
throw new Exception\SocketException('Socket closed by server!');
}
if (microtime(true) - $timer > $timeout) {
if (($data === false) && microtime(true) - $timer > $timeout) {
$this->disconnect();
throw new Exception\SocketException('Socket timed out!');
}
Expand Down

0 comments on commit 57b6e76

Please sign in to comment.