Skip to content

Commit 9aed188

Browse files
committed
Fix SocketIpcHub::accept if already cancelled
Relates to #199.
1 parent 9403846 commit 9aed188

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Ipc/SocketIpcHub.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ public function accept(string $key, ?Cancellation $cancellation = null): Resourc
165165
$this->queued = true;
166166
}
167167

168-
$this->waitingByKey[$key] = $suspension = EventLoop::getSuspension();
169-
170168
$cancellation = $cancellation ?? new NullCancellation();
169+
$cancellation->throwIfRequested();
170+
171+
$this->waitingByKey[$key] = $suspension = EventLoop::getSuspension();
171172
$cancellationId = $cancellation->subscribe(function (CancelledException $exception) use ($suspension) {
172173
$suspension->throw($exception);
173174
});

0 commit comments

Comments
 (0)