From 6b59c8aee7824668dd5da3842830f46f925c8b44 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 8 Sep 2003 20:58:40 +0000 Subject: [PATCH] add TCP_CORK support --- io/iob_send.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/io/iob_send.c b/io/iob_send.c index 5bc4aff..56e9a08 100644 --- a/io/iob_send.c +++ b/io/iob_send.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #ifdef __linux__ #include #endif @@ -63,6 +65,12 @@ int64 iob_send(int64 s,io_batch* b) { } else sent=writev(s,v,headers); #else +#ifdef TCP_CORK + if (b->bufs && b->files && !b->next) { + static int one=1; + setsockopt(s,IPPROTO_TCP,TCP_CORK,&one,sizeof(one)); + } +#endif if (headers) sent=writev(s,v,headers); else @@ -74,6 +82,12 @@ int64 iob_send(int64 s,io_batch* b) { if (!total) return -1; if (sent==b->bytesleft) { b->bytesleft=0; +#ifdef TCP_CORK + if (b->bufs && b->files) { + static int zero=0; + setsockopt(s,IPPROTO_TCP,TCP_CORK,&zero,sizeof(zero)); + } +#endif break; } else if (sent>0) { int64 rest=sent;