vapor-community / sockets

🔌 Non-blocking TCP socket layer, with event-driven server and client.
MIT License
575 stars 54 forks source link

Handle interruption (e.g. debugger signals) in socket calls #59

Closed czechboy0 closed 7 years ago

czechboy0 commented 8 years ago

Currently when you e.g. set a breakpoint in Xcode while the code is blocking on select (or any other blocking socket call), it'll fail with error interrupted. We should check for this error and retry, or even better look into using the SA_RESTART flag so that the system calls are resumed, instead of aborted, when a signal arrives.

/cc @tannernelson

tanner0101 commented 8 years ago

I just used something like this to catch interrupts in my command line app.

signal(SIGINT) { sig in
    terminal.killTasks()
    exit(2)
}
czechboy0 commented 8 years ago

Were you able to debug such process with lldb though? I think when you add a new breakpoint while there's a running socket call, it'll fail.

loganwright commented 7 years ago

I haven't seen this in a really long time, I think the issue is resolved