Pārlūkot izejas kodu

Removed the default value for the read_write_timeout when initializing the connection stream. Now the timeout for r/w operations on the stream is set only if it has been set in the ConnectionParameters instance, otherwise the system default will be implicitly used (the default is usually 60 seconds).

Daniele Alessandri 15 gadi atpakaļ
vecāks
revīzija
7c6e03edae
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      lib/Predis.php

+ 4 - 2
lib/Predis.php

@@ -525,7 +525,6 @@ interface IConnection {
 
 class Connection implements IConnection {
     const CONNECTION_TIMEOUT = 2;
-    const READ_WRITE_TIMEOUT = 5;
 
     private $_params, $_socket, $_initCmds;
 
@@ -552,7 +551,10 @@ class Connection implements IConnection {
         if (!$this->_socket) {
             throw new ClientException(trim($errstr), $errno);
         }
-        stream_set_timeout($this->_socket, $this->_params->read_write_timeout ?: self::READ_WRITE_TIMEOUT);
+
+        if (isset($this->_params->read_write_timeout)) {
+            stream_set_timeout($this->_socket, $this->_params->read_write_timeout);
+        }
 
         if (count($this->_initCmds) > 0){
             $this->sendInitializationCommands();