Fix Socket::sync if a client is disconnected#31
Fix Socket::sync if a client is disconnected#31lishuren wants to merge 1 commit intoLichtso:masterfrom
Conversation
If a client is disconnected during the transfer progress, socket status will be BUSY. Socket::sync will not be able to write any data and should return EOF instead.
|
You mean the connection is not shut down gracefully, instead the ACK timers run out and the output buffer fills up. Interesting, is there a specific example where it would help to return EOF instead of 0? |
|
Hi Lichtso, First of all, thanks for your work and your project. netLink is such a neat and elegant lib. I like it very much. You are correct, the connection is not shut down gracefully. I am using netLink in the communication between a windows PC and an embedded linux. PC Server receives a request from a client, and then processes the request, finally echoes back. All the actions are done in onReceiveMsgPack. In my case, the embedded system might be shut down accidentally, while PC box is still sending large data set. At the moment, the PC box's socket status is BUSY. Here is an example: Adding the following code as server side, send an message from a client and immediately kill the client. The server takes time to send all bytes to socket. I have tested to return EOF or 0. Both of them work. |
|
I will have to investigate this further:
|
If a client is disconnected during the transfer progress, socket status will be BUSY. Socket::sync will not be able to write any data and should return EOF instead.