Skip to content

Commit

Permalink
Socket: Keep listening on a closed socket
Browse files Browse the repository at this point in the history
This is a pretty specific circumstance, but it's possible the TCP transport is closed while we're still processing TLS records, in which case we'd simply be discarding that data, which is not very desirable.
Soup also already handles this and will call our recv callback with the remaining data before concluding.
  • Loading branch information
Sainan committed Oct 29, 2024
1 parent d0d7b34 commit ef1ccdb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lsocketlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ struct StandaloneSocket {
sock->recv([](soup::Socket&, std::string&& data, soup::Capture&& cap) SOUP_EXCAL {
StandaloneSocket& ss = *cap.get<StandaloneSocket*>();
ss.recvd.push_back(std::move(data));
if (!ss.sock->remote_closed)
ss.recvLoop();
ss.recvLoop();
}, this);
}
};
Expand Down

0 comments on commit ef1ccdb

Please sign in to comment.