From ae3b37460b677ebd6f1ad12dab76055e7879fcaf Mon Sep 17 00:00:00 2001 From: james Date: Tue, 18 Nov 2008 05:15:22 +0000 Subject: Added --tcp-nodelay option: Macro that sets TCP_NODELAY socket flag on the server as well as pushes it to connecting clients. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3513 e7ae566f-a301-0410-adde-c780ea21d3b5 --- helper.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'helper.c') diff --git a/helper.c b/helper.c index 2abb417..a8bbea0 100644 --- a/helper.c +++ b/helper.c @@ -96,6 +96,14 @@ print_str_int (const char *str, const int i, struct gc_arena *gc) return BSTR (&out); } +static const char * +print_str (const char *str, struct gc_arena *gc) +{ + struct buffer out = alloc_buf_gc (128, gc); + buf_printf (&out, "%s", str); + return BSTR (&out); +} + static void helper_add_route (const in_addr_t network, const in_addr_t netmask, struct options *o) { @@ -438,3 +446,34 @@ helper_keepalive (struct options *o) } } } + +/* + * + * HELPER DIRECTIVE: + * + * tcp-nodelay + * + * EXPANDS TO: + * + * if mode server: + * socket-flags TCP_NODELAY + * push "socket-flags TCP_NODELAY" + */ +void +helper_tcp_nodelay (struct options *o) +{ +#if P2MP_SERVER + if (o->server_flags & SF_TCP_NODELAY_HELPER) + { + if (o->mode == MODE_SERVER) + { + o->sockflags |= SF_TCP_NODELAY; + push_option (o, print_str ("socket-flags TCP_NODELAY", &o->gc), M_USAGE); + } + else + { + ASSERT (0); + } + } +#endif +} -- cgit