Skip to content

Commit

Permalink
properly close serial client without unnecessary errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Sep 16, 2024
1 parent c16b9f5 commit e02f5b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,13 @@ static void modesCloseClient(struct client *c) {
}

epoll_ctl(Modes.net_epfd, EPOLL_CTL_DEL, c->fd, &c->epollEvent);
anetCloseSocket(c->fd);
if (c->serial) {
if (close(c->fd) < 0) {
fprintf(stderr, "Serial client close error: %s\n", strerror(errno));
}
} else {
anetCloseSocket(c->fd);
}
c->service->connections--;
Modes.modesClientCount--;
if (c->service->writer) {
Expand Down

0 comments on commit e02f5b6

Please sign in to comment.