Line | |
---|
1 | #define _GNU_SOURCE |
---|
2 | #include <dlfcn.h> |
---|
3 | #include <sys/types.h> |
---|
4 | #include <sys/socket.h> |
---|
5 | #include <netinet/in.h> |
---|
6 | #include <netinet/tcp.h> |
---|
7 | |
---|
8 | int connect(int sock, const struct sockaddr *addr, socklen_t addrlen) |
---|
9 | { |
---|
10 | int (*next_connect)(int, const struct sockaddr *, socklen_t) = |
---|
11 | dlsym(RTLD_NEXT, "connect"); |
---|
12 | int res = next_connect(sock, addr, addrlen); |
---|
13 | if (!res && addr->sa_family == AF_INET) { |
---|
14 | int opt = 1; |
---|
15 | setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); |
---|
16 | } |
---|
17 | return res; |
---|
18 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.