Skip to content

Commit

Permalink
Add a delay to shutdown after the socket closes to give time for proc…
Browse files Browse the repository at this point in the history
…essing received packets
  • Loading branch information
SeanMollet committed Sep 27, 2024
1 parent 4bf08fd commit 174eb0d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/impl/tcptransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ void TcpTransport::process(PollService::Event event) {
PLOG_ERROR << e.what();
}

// Allow any received messages to be processed before we shut down and destroy the callbacks
// This should probably be a mutex or check of a queue size or something, but I can't figure out
// what to do that against and a 100ms delay seems to be plenty

usleep(100 * 1000);
PLOG_INFO << "TCP disconnected";
PollService::Instance().remove(mSock);
changeState(State::Disconnected);
Expand Down

0 comments on commit 174eb0d

Please sign in to comment.