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

Commit 8d2627d

Browse files
authored
Catch errors to prevent hanging error connections (#10)
1 parent b07de03 commit 8d2627d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Internal/Sink.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public function __construct(ConnectionInterface $src)
2727
$this->dst->end();
2828
}
2929
});
30+
$src->on('error', function () {
31+
$this->end = true;
32+
if ($this->dst) {
33+
$this->dst->end();
34+
}
35+
});
3036
}
3137

3238
public function pipe(WritableStreamInterface $dst)

0 commit comments

Comments
 (0)