tpws: use SPLICE_PRESENT define for nosplice

This commit is contained in:
bol-van 2024-04-04 11:40:42 +03:00
parent a570845453
commit 72762694df
4 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
CC ?= cc
CFLAGS += -std=gnu99 -s -O3 -Wno-logical-op-parentheses
LIBS = -lz
LIBS = -lz -lpthread
SRC_FILES = *.c
all: tpws

View File

@ -1,7 +1,7 @@
CC ?= gcc
CFLAGS += -std=gnu99 -Wno-logical-op-parentheses -O3
CFLAGS_BSD = -Wno-address-of-packed-member -Wno-switch
LIBS = -lz
LIBS = -lz -lpthread
SRC_FILES = *.c
all: tpws

View File

@ -6,6 +6,7 @@
#include <sys/param.h>
#include <sys/queue.h>
#include <time.h>
#include "tpws.h"
#include "pools.h"
#define HOSTLIST_AUTO_FAIL_THRESHOLD_DEFAULT 3
@ -81,7 +82,7 @@ struct params_s
#if defined(BSD)
bool pf_enable;
#endif
#ifdef __linux__
#ifdef SPLICE_PRESENT
bool nosplice;
#endif
};

View File

@ -144,7 +144,7 @@ static void exithelp(void)
" --local-sndbuf=<bytes>\n"
" --remote-rcvbuf=<bytes>\n"
" --remote-sndbuf=<bytes>\n"
#ifdef __linux__
#ifdef SPLICE_PRESENT
" --nosplice\t\t\t\t; do not use splice to transfer data between sockets\n"
#endif
" --skip-nodelay\t\t\t\t; do not set TCP_NODELAY option for outgoing connections (incompatible with split options)\n"
@ -336,7 +336,9 @@ void parse_params(int argc, char *argv[])
#elif defined(__linux__)
{ "mss",required_argument,0,0 },// optidx=53
{ "mss-pf",required_argument,0,0 },// optidx=54
#ifdef SPLICE_PRESENT
{ "nosplice",no_argument,0,0 },// optidx=55
#endif
#endif
{ "hostlist-auto-retrans-threshold",optional_argument,0,0}, // ignored. for nfqws command line compatibility
{ NULL,0,NULL,0 }
@ -777,9 +779,11 @@ void parse_params(int argc, char *argv[])
exit_clean(1);
}
break;
#ifdef SPLICE_PRESENT
case 55: /* nosplice */
params.nosplice = true;
break;
#endif
#endif
}
}