Open Henrik0x7F opened 6 years ago
Any progress on this? I'm facing the same problem.
My workaround was to add closesocket(sockfd);
after line 425 in easywsclient.cpp. I don't know if it closes the connection properly but it at least doesn't keep it open forever. I myself have switched to websocketpp, a more complete library which doesn't suffer from this issue.
My workaround was to add
closesocket(sockfd);
after line 425 in easywsclient.cpp. I don't know if it closes the connection properly but it at least doesn't keep it open forever. I myself have switched to websocketpp, a more complete library which doesn't suffer from this issue.
it works. not exact line 425, but at the end of close() function body.
I have noticed this behavior can be seen by running the tests:
make test
, start the testServer.js
with node
, and launch easywsclient.t
in a debugger such as GDB.main()
to prevent the test application from closing after RUN_ALL_TESTS()
returns.$ lsof -p $(pidof easywsclient.t) | grep TCP
easywscli 22634 james 3u IPv6 634795 0t0 TCP localhost:36496->localhost:8123 (ESTABLISHED)
easywscli 22634 james 4u IPv6 634799 0t0 TCP localhost:36498->localhost:8123 (ESTABLISHED)
easywscli 22634 james 5u IPv6 643270 0t0 TCP localhost:36500->localhost:8123 (ESTABLISHED)
easywscli 22634 james 6u IPv6 643274 0t0 TCP localhost:36502->localhost:8123 (ESTABLISHED)
I expected the TCP sockets to be closed when the WebSocket
class is destroyed, regardless if WebSocket::close()
has been called. I observed this behavior with commit afc1d8cfc584e0f1f4a77e8c0ce3e979d9fe7ce2.
I'm calling Websocket::close() in my destructor, but the it disconnects only if I close my program.