diff options
Diffstat (limited to 'helper.c')
-rw-r--r-- | helper.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -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 +} |