Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit db0a701

Browse files
authored
Merge pull request #63 from reactphp-parallel/silence-channel-closed-errors-on-proxy-close
Silence channel closed errors on proxy close
2 parents 6912ce6 + 298b63b commit db0a701

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

infection.json.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@
6868
"ReactParallel\\ObjectProxy\\Proxy\\Registry::__construct"
6969
]
7070
},
71+
"LogicalOr": {
72+
"ignore": [
73+
"ReactParallel\\ObjectProxy\\Proxy\\Handler::handleExistence",
74+
"ReactParallel\\ObjectProxy\\Proxy\\Handler::countDestruct",
75+
"ReactParallel\\ObjectProxy\\Proxy\\Handler::handleDestruct",
76+
"ReactParallel\\ObjectProxy\\Proxy\\Handler::handleNotify",
77+
"ReactParallel\\ObjectProxy\\Proxy\\Handler::handleCall",
78+
"ReactParallel\\ObjectProxy\\Proxy\\Registry::__construct"
79+
]
80+
},
7181
"MethodCallRemoval": {
7282
"ignore": [
7383
"ReactParallel\\ObjectProxy\\Proxy::__destruct",

src/Proxy.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace ReactParallel\ObjectProxy;
66

77
use parallel\Channel;
8+
use parallel\Channel\Error\Closed;
89
use React\EventLoop\StreamSelectLoop;
910
use ReactParallel\EventLoop\EventLoopBridge;
1011
use ReactParallel\Factory;
@@ -156,11 +157,19 @@ public function close(): void
156157
$this->closed = TRUE_;
157158

158159
foreach ($this->destruct as $destruct) {
159-
$destruct->send('bye');
160-
$destruct->close();
160+
try {
161+
$destruct->send('bye');
162+
$destruct->close();
163+
} catch (Closed $closed) {
164+
// @ignoreException
165+
}
161166
}
162167

163-
$this->in->close();
168+
try {
169+
$this->in->close();
170+
} catch (Closed $closed) {
171+
// @ignoreException
172+
}
164173
}
165174

166175
public function __destruct()

0 commit comments

Comments
 (0)