File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,16 @@ public function addAwaitCallback(callable $callback)
297
297
*/
298
298
public function onDataAvailable ()
299
299
{
300
- $ this ->read ();
300
+ try {
301
+ $ this ->read ();
302
+ } catch (\Throwable $ e ) {
303
+ foreach ($ this ->awaitCallbacks as $ k => $ callback ) {
304
+ if ($ callback ($ e ) === true ) {
305
+ unset($ this ->awaitCallbacks [$ k ]);
306
+ break ;
307
+ }
308
+ }
309
+ }
301
310
302
311
while (($ frame = $ this ->reader ->consumeFrame ($ this ->readBuffer )) !== null ) {
303
312
foreach ($ this ->awaitCallbacks as $ k => $ callback ) {
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ public function run($maxSeconds = null)
191
191
$ now = microtime (true );
192
192
$ nextStreamSelectTimeout = ($ this ->lastWrite ?: $ now ) + $ this ->options ["heartbeat " ];
193
193
if (!isset ($ nextHeartbeat )) {
194
- $ nextHeartbeat = $ now + $ this -> options [ " heartbeat " ] ;
194
+ $ nextHeartbeat = $ nextStreamSelectTimeout ; ;
195
195
}
196
196
if ($ stopTime !== null && $ stopTime < $ nextStreamSelectTimeout ) {
197
197
$ nextStreamSelectTimeout = $ stopTime ;
You can’t perform that action at this time.
0 commit comments