@@ -88,7 +88,7 @@ public function send(Protocol\AbstractFrame $frame): Promise
8888 // payload already supplied
8989 } elseif ($ frame instanceof MethodFrame || $ frame instanceof ContentHeaderFrame) {
9090 $ buffer = $ frame ->pack ();
91-
91+
9292 $ frame ->size = $ buffer ->size ();
9393 $ frame ->payload = $ buffer ;
9494 } elseif ($ frame instanceof Protocol \ContentBodyFrame) {
@@ -156,10 +156,11 @@ public function cancel(int $channel): void
156156 public function open (int $ timeout , int $ maxAttempts , bool $ noDelay ): Promise
157157 {
158158 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+ }
163164
164165 if ($ noDelay ) {
165166 $ context ->withTcpNoDelay ();
@@ -182,7 +183,7 @@ public function open(int $timeout, int $maxAttempts, bool $noDelay): Promise
182183 }
183184 }
184185
185- unset( $ this ->socket ) ;
186+ $ this ->socket = null ;
186187 });
187188 });
188189 }
@@ -197,7 +198,7 @@ public function heartbeat(int $interval): void
197198 $ milliseconds = $ interval * 1000 ;
198199
199200 $ this ->heartbeat = Loop::repeat ($ milliseconds , function ($ watcher ) use ($ milliseconds ) {
200- if (! $ this ->socket ) {
201+ if (null === $ this ->socket ) {
201202 Loop::cancel ($ watcher );
202203
203204 return ;
0 commit comments