-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
I was trying to do the websocket tutorial/examples and implement a chat, and found that my server code wasn't cleaning up clients when they disconnected. Even when running the websocket example, the StreamHandler's finished() method doesn't ever get called. That is, if I add a finished() method to examples/websocket/src/main.rs, similar to the client one, and run:
cd examples/websocket
cargo run --bin serverand also
cd examples/websocket
cargo run --bin clientand then hit CTRL-C on the client, then the server doesn't notice. Whereas if I hit CTRL-C on the server, the client does get a "Server disconnected" message within a few seconds, meaning finished() was called.
(Also, I noticed that the server is using WebsocketContext, while the client is using a regular Context. Shouldn't the client also use WebsocketContext?)
netstat shows that the client closes its half of the socket for writing / sends a FIN (FIN_WAIT2 state) while the server is keeping its half open (CLOSE_WAIT state).
This also happens with current actix-web/master / 0.7.8 and actix 0.7.0. I also tried actix master, but then the example doesn't compile anymore.