File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,14 @@ public function recv(int $streamId, float $timeout = null)
238
238
if ($ response === false && $ channel ->errCode === SWOOLE_CHANNEL_TIMEOUT ) {
239
239
unset($ this ->recvChannelMap [$ streamId ]);
240
240
}
241
+ // Unset recvChannelMap arfter recv
242
+ if (! $ response ->pipeline ) {
243
+ unset($ this ->recvChannelMap [$ streamId ]);
244
+ if (! $ channel ->isEmpty ()) {
245
+ $ channel ->pop ();
246
+ }
247
+ $ this ->channelPool ->push ($ channel );
248
+ }
241
249
242
250
return $ response ;
243
251
}
@@ -303,13 +311,6 @@ private function runReceiveCoroutine()
303
311
}
304
312
$ channel = $ this ->recvChannelMap [$ streamId ];
305
313
$ channel ->push ($ response );
306
- if (! $ response ->pipeline ) {
307
- unset($ this ->recvChannelMap [$ streamId ]);
308
- if (! $ channel ->isEmpty ()) {
309
- $ channel ->pop ();
310
- }
311
- $ this ->channelPool ->push ($ channel );
312
- }
313
314
// If wait status is equal to WAIT_CLOSE, and no coroutine is waiting, then break the recv loop.
314
315
if ($ this ->waitStatus === Status::WAIT_CLOSE && empty ($ this ->recvChannelMap )) {
315
316
break ;
You can’t perform that action at this time.
0 commit comments