Browse Source

Add helper function to set no linger

master
Con Kolivas 10 years ago
parent
commit
8e29c957e0
  1. 7
      src/libckpool.c
  2. 1
      src/libckpool.h

7
src/libckpool.c

@ -418,6 +418,13 @@ void keep_sockalive(int fd)
setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl));
}
void nolinger_socket(int fd)
{
const struct linger so_linger = { 1, 0 };
setsockopt(fd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof(so_linger));
}
void noblock_socket(int fd)
{
int flags = fcntl(fd, F_GETFL, 0);

1
src/libckpool.h

@ -413,6 +413,7 @@ static inline bool sock_timeout(void)
bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port);
void keep_sockalive(int fd);
void nolinger_socket(int fd);
void noblock_socket(int fd);
void block_socket(int fd);
void _Close(int *fd);

Loading…
Cancel
Save