@@ -88,7 +88,7 @@ public function send(Protocol\AbstractFrame $frame): Promise
88
88
// payload already supplied
89
89
} elseif ($ frame instanceof MethodFrame || $ frame instanceof ContentHeaderFrame) {
90
90
$ buffer = $ frame ->pack ();
91
-
91
+
92
92
$ frame ->size = $ buffer ->size ();
93
93
$ frame ->payload = $ buffer ;
94
94
} elseif ($ frame instanceof Protocol \ContentBodyFrame) {
@@ -156,10 +156,11 @@ public function cancel(int $channel): void
156
156
public function open (int $ timeout , int $ maxAttempts , bool $ noDelay ): Promise
157
157
{
158
158
return call (function () use ($ timeout , $ maxAttempts , $ noDelay ) {
159
- $ context = (new ClientConnectContext )
160
- ->withConnectTimeout ($ timeout )
161
- ->withMaxAttempts ($ maxAttempts )
162
- ;
159
+ $ context = (new ClientConnectContext )->withMaxAttempts ($ maxAttempts );
160
+
161
+ if ($ timeout > 0 ) {
162
+ $ context = $ context ->withConnectTimeout ($ timeout );
163
+ }
163
164
164
165
if ($ noDelay ) {
165
166
$ context ->withTcpNoDelay ();
@@ -182,7 +183,7 @@ public function open(int $timeout, int $maxAttempts, bool $noDelay): Promise
182
183
}
183
184
}
184
185
185
- unset( $ this ->socket ) ;
186
+ $ this ->socket = null ;
186
187
});
187
188
});
188
189
}
@@ -197,7 +198,7 @@ public function heartbeat(int $interval): void
197
198
$ milliseconds = $ interval * 1000 ;
198
199
199
200
$ this ->heartbeat = Loop::repeat ($ milliseconds , function ($ watcher ) use ($ milliseconds ) {
200
- if (! $ this ->socket ) {
201
+ if (null === $ this ->socket ) {
201
202
Loop::cancel ($ watcher );
202
203
203
204
return ;
0 commit comments