File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,6 @@ fn (mut pv Picoev) del(fd int) int {
106
106
}
107
107
108
108
if pv.update_events (fd, picoev.picoev_del) != 0 {
109
- target.loop_id = - 1
110
- target.fd = 0
111
109
return - 1
112
110
}
113
111
@@ -149,15 +147,20 @@ fn (mut pv Picoev) set_timeout(fd int, secs int) {
149
147
// timeout event
150
148
[direct_array_access; inline]
151
149
fn (mut pv Picoev) handle_timeout () {
150
+ mut to_remove := []int {}
151
+
152
152
for fd, timeout in pv.timeouts {
153
153
if timeout < = pv.loop.now {
154
- target := pv.file_descriptors[fd]
155
- assert target.loop_id == pv.loop.id
156
-
157
- pv.timeouts.delete (fd)
158
- unsafe { target.cb (fd, picoev.picoev_timeout, & pv) }
154
+ to_remove << fd
159
155
}
160
156
}
157
+
158
+ for fd in to_remove {
159
+ target := pv.file_descriptors[fd]
160
+ assert target.loop_id == pv.loop.id
161
+ pv.timeouts.delete (fd)
162
+ unsafe { target.cb (fd, picoev.picoev_timeout, & pv) }
163
+ }
161
164
}
162
165
163
166
// accept_callback accepts a new connection from `listen_fd` and adds it to the loop
You can’t perform that action at this time.
0 commit comments