From 6f65fedbbdf6633bf061204ad5dd7c0de324f303 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 8 Aug 2016 12:59:33 +0800 Subject: [PATCH] Move TCP_FASTOPEN to netutils.h --- src/common.h | 21 --------------------- src/netutils.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/common.h b/src/common.h index f093db6f..6f6c6fd9 100644 --- a/src/common.h +++ b/src/common.h @@ -22,27 +22,6 @@ #ifndef _COMMON_H #define _COMMON_H -// only enable TCP_FASTOPEN on linux -#if defined(__linux__) - -/* conditional define for TCP_FASTOPEN */ -#ifndef TCP_FASTOPEN -#define TCP_FASTOPEN 23 -#endif - -/* conditional define for MSG_FASTOPEN */ -#ifndef MSG_FASTOPEN -#define MSG_FASTOPEN 0x20000000 -#endif - -#elif !defined(__APPLE__) - -#ifdef TCP_FASTOPEN -#undef TCP_FASTOPEN -#endif - -#endif - #define DEFAULT_CONF_PATH "/etc/shadowsocks-libev/config.json" #ifndef SOL_TCP diff --git a/src/netutils.h b/src/netutils.h index 1bdbb38e..2f1be483 100644 --- a/src/netutils.h +++ b/src/netutils.h @@ -23,6 +23,28 @@ #ifndef _NETUTILS_H #define _NETUTILS_H +// only enable TCP_FASTOPEN on linux +#if defined(__linux__) + +/* conditional define for TCP_FASTOPEN */ +#ifndef TCP_FASTOPEN +#define TCP_FASTOPEN 23 +#endif + +/* conditional define for MSG_FASTOPEN */ +#ifndef MSG_FASTOPEN +#define MSG_FASTOPEN 0x20000000 +#endif + +#elif !defined(__APPLE__) + +#ifdef TCP_FASTOPEN +#undef TCP_FASTOPEN +#endif + +#endif + + /* Define the flag MPTCP_ENABLED if not defined*/ #ifndef MPTCP_ENABLED #define MPTCP_ENABLED 26