Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make websocket close behave more like lwip-raw tcp #3

Open
lhartmann opened this issue Mar 27, 2018 · 0 comments
Open

Make websocket close behave more like lwip-raw tcp #3

lhartmann opened this issue Mar 27, 2018 · 0 comments

Comments

@lhartmann
Copy link

When LWIP RAW TCP connections are closed LWIP calls the data callback with a null pointer, so application code knows that socket is invalidated, and gets a chance to clear all references to it.

"If the remote host closes the connection, the callback function will be called with a NULL pbuf to indicate that fact." http://lwip.wikia.com/wiki/Raw/TCP

When a websocket connection is closed (either by the client or for conserving memory) there is no such warning. Any writes to a socket outside it's data callback, where it is guaranteed to be valid, may potentially write to a closed socket (or worse, freed).

This which limits application to a ping-pong polling scenario which, while it works lika a charm, is not exactly the spirit of websockets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant