plasticrake / tplink-smarthome-api

TP-Link Smarthome WiFi API
MIT License
1.02k stars 141 forks source link

Should not clear the socket timeout here #108

Closed aanon4 closed 2 years ago

aanon4 commented 3 years ago

https://github.com/plasticrake/tplink-smarthome-api/blob/4f684a55f9db919e2ee4274fd60b0c52dcfdb75f/src/network/tcp-socket.ts#L101

The timeout shouldn't be cleared at the point above. The later socket.end doesn't guarantee the other end will correctly close down the socket, which means the 'close' event might not happen; so keep the timer running until it does. I realize this shouldn't happen, but I've seen FIN_WAIT_2 sockets hanging out forever when using this with homebridge, which suggests it can.

plasticrake commented 2 years ago

Thanks for the tip!