Skip to content

Commit 4a286db

Browse files
committed
tcp_server: Close socket before calling the disconnection_callback
1 parent c1a8aa2 commit 4a286db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/comm/tcp_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ void TCPServer::spin()
247247
void TCPServer::handleDisconnect(const int fd)
248248
{
249249
URCL_LOG_DEBUG("%d disconnected.", fd);
250+
close(fd);
250251
if (disconnect_callback_)
251252
{
252253
disconnect_callback_(fd);
253254
}
254-
close(fd);
255255
FD_CLR(fd, &masterfds_);
256256

257257
for (size_t i = 0; i < client_fds_.size(); ++i)

0 commit comments

Comments
 (0)