Skip to content

Commit a508151

Browse files
authored
Merge pull request #23 from vaikas/fix-delete-socket
Fix the bug with linked list removal.
2 parents 910aaef + 76644d5 commit a508151

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ static void state_remove_socket_fd(struct state *state, int socket_fd) {
113113
dispatch_semaphore_wait(state->sem, DISPATCH_TIME_FOREVER);
114114
if (state->conns != NULL) {
115115
if (state->conns->socket_fd == socket_fd) {
116-
state->conns = NULL;
116+
state->conns = state->conns->next;
117117
} else {
118118
struct conn *conn;
119119
for (conn = state->conns; conn->next != NULL; conn = conn->next) {
120120
if (conn->next->socket_fd == socket_fd) {
121-
conn->next = NULL;
121+
conn->next = conn->next->next;
122122
}
123123
}
124124
}

0 commit comments

Comments
 (0)