vbmithr / ocaml-websocket

Websocket library for OCaml
ISC License
163 stars 44 forks source link

Prevent fd leakage #16

Closed vbmithr closed 10 years ago

vbmithr commented 10 years ago

Currently the functions returning streams lack a way to close the underlying connection, causing fds to leak.

darioteixeira commented 10 years ago

I'm currently being bitten by this problem... ;-)

Anyway, I reckon the approach more convenient for users would be for Websocket.establish_server to automatically close the FD when the callback function terminates.

The question remains, however, whether to expect users to explicitly check within the callback function whether Frame.opcode is Close (and terminate if so), or if Websocket.establish_server should do that automatically as well. I think the first approach may be more flexible, as long as the documentation states in very big letters that users should be diligent under penalty of leaking FDs...

vbmithr commented 10 years ago

I think this is fixed now. Please reopen if not.