billhsu / jUART

Cross platform browser plugin for serial port communication from JavaScript
202 stars 76 forks source link

jUART breaks if socket is closed due to error #33

Closed gmkarl closed 9 years ago

gmkarl commented 9 years ago

I'm experiencing that if an error occurs midstream, jUART is left in a broken state where it can no longer open a socket and communicate.

I think this is because an error created by the async recv or send calls results in a premature call to SerialAPI::do_close which ends the io loop with no associated io.reset() call to reset the io loop, resulting in the next call to io.run() returning immediately, but I haven't verified this yet.

I'm testing this error using socat -v -x pty,raw,echo=0,link=ttyfake1 pty,raw,echo=0,link=ttyfake2, opening ttyfake1 with jUART, then killing the socat process to trigger a premature close.