Skip to content

Commit 523a4bb

Browse files
committed
Resume last in shutdown
1 parent bc495cd commit 523a4bb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libraries/llvm/io.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,18 +415,19 @@ void c_tcp_listen(Int listener, struct Pos handler, Stack stack) {
415415

416416
void c_tcp_shutdown(Int handle, Stack stack) {
417417
uv_handle_t* uv_handle = (uv_handle_t*)handle;
418-
419418
tcp_listen_closure_t* listen_closure = (tcp_listen_closure_t*)uv_handle->data;
419+
420+
uv_handle->data = stack;
421+
uv_close(uv_handle, c_tcp_close_cb);
422+
420423
if (listen_closure) {
421-
// TODO what to resume with
422-
// TODO resume last
423-
resume_Int(listen_closure->stack, 0);
424-
erasePositive(listen_closure->handler);
424+
Stack closure_stack = listen_closure->stack;
425+
struct Pos closure_handler = listen_closure->handler;
425426
free(listen_closure);
427+
erasePositive(closure_handler);
428+
resume_Int(closure_stack, 0);
426429
}
427430

428-
uv_handle->data = stack;
429-
uv_close(uv_handle, c_tcp_close_cb);
430431
}
431432

432433

0 commit comments

Comments
 (0)