mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-21 11:48:57 +00:00
support MSG_FASTOPEN on old kernels
This commit is contained in:
parent
8dd08e2cd2
commit
4e986caa2a
@ -482,9 +482,12 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
# define MSG_FASTOPEN 0x20000000
|
||||
#endif
|
||||
|
||||
ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,
|
||||
const struct sockaddr *dest_addr, socklen_t addrlen) {
|
||||
#ifdef MSG_FASTOPEN
|
||||
if (flags & MSG_FASTOPEN) {
|
||||
if (!connect(sockfd, dest_addr, addrlen) && errno != EINPROGRESS) {
|
||||
return -1;
|
||||
@ -493,6 +496,5 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,
|
||||
addrlen = 0;
|
||||
flags &= ~MSG_FASTOPEN;
|
||||
}
|
||||
#endif
|
||||
return true_sendto(sockfd, buf, len, flags, dest_addr, addrlen);
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
# define MSG_FASTOPEN 0x20000000
|
||||
#endif
|
||||
|
||||
void error(const char *msg)
|
||||
{
|
||||
perror(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user