Skip to content

Commit 9bf9af5

Browse files
committed
Revert "When closing the socket, force close the socket after a timeout"
This reverts commit d4805cd. Contributes to CURA-1453 and CURA-1391
1 parent 5e2c5de commit 9bf9af5

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Diff for: src/Socket.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,10 @@ void Socket::close()
177177
// Make the socket request close.
178178
d->next_state = SocketState::Closing;
179179

180-
int timeout = 0;
181180
// Wait with closing until we properly clear the send queue.
182-
while(d->next_state == SocketState::Closing || d->state == SocketState::Closing)
181+
while(d->state == SocketState::Closing)
183182
{
184183
std::this_thread::sleep_for(std::chrono::milliseconds(100));
185-
186-
// In certain situations, the socket seems to stall on recv.
187-
timeout += 100;
188-
if(timeout > 1000)
189-
{
190-
d->error(ErrorCode::ReceiveFailedError, "Failed to cleanly close socket, force closing it");
191-
d->platform_socket.shutdown(PlatformSocket::ShutdownDirection::ShutdownBoth);
192-
d->platform_socket.close();
193-
d->next_state = SocketState::Error;
194-
}
195184
}
196185
}
197186
else

0 commit comments

Comments
 (0)