Skip to content

Commit 088c1eb

Browse files
authored
Merge dc51e38 into b2a510a
2 parents b2a510a + dc51e38 commit 088c1eb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Connection/StreamConnection.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ public function open() : Greeting
106106
}
107107

108108
$this->stream = $stream;
109-
\stream_set_timeout($this->stream, $this->options['socket_timeout']);
109+
$socketTimeoutMicroseconds = 0;
110+
if (is_float($this->options['socket_timeout'])) {
111+
$socketTimeoutMicroseconds = (int)($this->options['socket_timeout'] * 1000000);
112+
$this->options['socket_timeout'] = (int)($this->options['socket_timeout']);
113+
$socketTimeoutMicroseconds -= $this->options['socket_timeout'] * 1000000;
114+
}
115+
\stream_set_timeout($this->stream, $this->options['socket_timeout'], $socketTimeoutMicroseconds);
110116

111117
if ($this->options['persistent'] && \ftell($this->stream)) {
112118
return $this->greeting = Greeting::unknown();

0 commit comments

Comments
 (0)