commit d07e0212b7aa35cda8f900259e7faeab1667d38f
parent f7e2f6497a7fe3d7d1841df0dafa705e80084b3e
Author: Andrey Uzunov <andrey.uzunov@gmail.com>
Date: Sun, 7 Jul 2013 15:48:40 +0000
spdy: disable TCP_CORK when NO DELAY is set
Diffstat:
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/microspdy/io_raw.c b/src/microspdy/io_raw.c
@@ -159,12 +159,15 @@ SPDYF_raw_is_pending(struct SPDY_Session *session)
int
SPDYF_raw_before_write(struct SPDY_Session *session)
{
- int val = 1;
- int ret;
-
- ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val));
- if(-1 == ret)
- SPDYF_DEBUG("WARNING: Couldn't set the new connection to TCP_CORK");
+ if(0 == (SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags))
+ {
+ int val = 1;
+ int ret;
+
+ ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val));
+ if(-1 == ret)
+ SPDYF_DEBUG("WARNING: Couldn't set the new connection to TCP_CORK");
+ }
return SPDY_YES;
}
@@ -173,12 +176,15 @@ SPDYF_raw_before_write(struct SPDY_Session *session)
int
SPDYF_raw_after_write(struct SPDY_Session *session, int was_written)
{
- int val = 0;
- int ret;
-
- ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val));
- if(-1 == ret)
- SPDYF_DEBUG("WARNING: Couldn't unset the new connection to TCP_CORK");
+ if(0 == (SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags))
+ {
+ int val = 0;
+ int ret;
+
+ ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val));
+ if(-1 == ret)
+ SPDYF_DEBUG("WARNING: Couldn't unset the new connection to TCP_CORK");
+ }
return was_written;
}