Skip to content

Commit 141a77d

Browse files
committed
[EventLoop] Remove check on return value from streams callbacks.
This was an early addition but now that the event loop abstraction is mature enough it's definitely better to be explicit when removing a stream instead of relying on obscure values returned from callbacks.
1 parent 134b94d commit 141a77d

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

LibEventLoop.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ protected function createLibeventCallback()
3232

3333
try {
3434
if (($flags & EV_READ) === EV_READ && isset($readCallbacks[$id])) {
35-
if (call_user_func($readCallbacks[$id], $stream, $loop) === false) {
36-
$loop->removeReadStream($stream);
37-
}
35+
call_user_func($readCallbacks[$id], $stream, $loop);
3836
}
3937

4038
if (($flags & EV_WRITE) === EV_WRITE && isset($writeCallbacks[$id])) {
41-
if (call_user_func($writeCallbacks[$id], $stream, $loop) === false) {
42-
$loop->removeWriteStream($stream);
43-
}
39+
call_user_func($writeCallbacks[$id], $stream, $loop);
4440
}
4541
} catch (\Exception $ex) {
4642
// If one of the callbacks throws an exception we must stop the loop

StreamSelectLoop.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ protected function runStreamSelect()
125125
if ($read) {
126126
foreach ($read as $stream) {
127127
$listener = $this->readListeners[(int) $stream];
128-
if (call_user_func($listener, $stream, $this) === false) {
129-
$this->removeReadStream($stream);
130-
}
128+
call_user_func($listener, $stream, $this);
131129
}
132130
}
133131

@@ -138,9 +136,7 @@ protected function runStreamSelect()
138136
}
139137

140138
$listener = $this->writeListeners[(int) $stream];
141-
if (call_user_func($listener, $stream, $this) === false) {
142-
$this->removeWriteStream($stream);
143-
}
139+
call_user_func($listener, $stream, $this);
144140
}
145141
}
146142
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy