When you close a SSLSockets input or output stream the socket does not get closed leading to may
sockets in the CLOSE_WAIT state. This will eventually deplete the available file descriptors
Details
Details
- Reviewers
nicolasfella - Group Reviewers
KDE Connect - Commits
- R225:d4d4849f158a: Closing a SSLSockets input or output stream does not close the socket (https…
Before appying this patch share a file from desktop to android
After the share is finished issue the command:
netstat -pW | grep kde
There should be a line showing that the socket used is in the state CLOSE_WAIT like below
tcp6 0 0 ::ffff:192.168.0.32:33604 ::ffff:192.168.0.2:1739 CLOSE_WAIT 6200/org.kde.kdeconnect_tp
Apply this patch and repeat the test. Now there should no longer be any sockets in the CLOSE_WAIT state
Diff Detail
Diff Detail
- Repository
- R225 KDE Connect - Android application
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Comment Actions
Thanks for looking into this!
So now every time we are done with the payload we need to close both the InputStream and the socket? That seems like something that is easily forgotten. Maybe it would make sense to add a closePayload() method to NetworkPacket that closes both so you only need to call one method?
Comment Actions
- Encapsulate mPayload, mPayloadSocket and mPayloadSize in a NetworkPacket.Payload object for easier handling