Skip to content

Commit

Permalink
Merge pull request #685 from ytwang0320/kp
Browse files Browse the repository at this point in the history
set SO_LINGER to 0 in case of TIME_WAIT
  • Loading branch information
ywc689 authored Nov 21, 2020
2 parents 5835065 + 49cacc7 commit e93ade3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/keepalived/keepalived/core/layer4.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ socket_bind_connect(int fd, conn_opts_t *co)
return connect_error;
}
if (opt == SOCK_STREAM) {
/* free the tcp port after closing the socket descriptor, but
* allow time for a proper shutdown. */
/* free the tcp port after closing the socket descriptor */
li.l_onoff = 1;
li.l_linger = 5;
li.l_linger = 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof (struct linger)))
log_message(LOG_INFO, "Failed to set SO_LINGER for socket %d - errno %d (%m)", fd, errno);
}
Expand Down

0 comments on commit e93ade3

Please sign in to comment.