Changeset 105
- Timestamp:
- 03/02/08 21:35:46 (5 years ago)
- Files:
-
- 1 modified
-
trunk/Phergie/Driver/Streams.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Phergie/Driver/Streams.php
r103 r105 131 131 132 132 if ($this->getIni('timeout')) { 133 stream_set_timeout($this->socket, $this->getIni('timeout') * 60);133 $timeout = $this->getIni('timeout') * 60; 134 134 } elseif ($this->getIni('keepalive')) { 135 stream_set_timeout($this->socket, 400); 135 $timeout = 600; 136 } else { 137 $timeout = false; 136 138 } 139 $lastPacket = time(); 137 140 138 141 unset($port); … … 176 179 $buffer = fgets($this->socket, 512); 177 180 178 $checkTimeout = stream_get_meta_data($this->socket); 179 if ($checkTimeout['timed_out'] === true) { 180 $this->debug('Timed out'); 181 foreach ($this->plugins as $plugin) { 182 $plugin->shutdown(); 183 } 184 break 2; 181 // Check if we timed out 182 if ($timeout !== false) { 183 // Reset last packet timestamp if we received something 184 if (!empty($buffer)) { 185 $lastPacket = time(); 186 } 187 // Timed out, exit 188 if ($lastPacket < (time() - $timeout)) { 189 $this->debug('Timed out'); 190 foreach ($this->plugins as $plugin) { 191 $plugin->shutdown(); 192 } 193 break 2; 194 } 185 195 } 186 196 }