aboutsummaryrefslogtreecommitdiff
path: root/src/microspdy/io_raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microspdy/io_raw.c')
-rw-r--r--src/microspdy/io_raw.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/microspdy/io_raw.c b/src/microspdy/io_raw.c
index 7d340fa7..dda1bc08 100644
--- a/src/microspdy/io_raw.c
+++ b/src/microspdy/io_raw.c
@@ -26,6 +26,8 @@
26#include "internal.h" 26#include "internal.h"
27#include "session.h" 27#include "session.h"
28#include "io_raw.h" 28#include "io_raw.h"
29//TODO put in in the right place
30#include <netinet/tcp.h>
29 31
30 32
31void 33void
@@ -60,14 +62,21 @@ int
60SPDYF_raw_new_session(struct SPDY_Session *session) 62SPDYF_raw_new_session(struct SPDY_Session *session)
61{ 63{
62 int fd_flags; 64 int fd_flags;
65 int val = 1;
66 int ret;
63 67
64 //setting the socket to be non-blocking 68 //setting the socket to be non-blocking
65 fd_flags = fcntl (session->socket_fd, F_GETFL); 69 fd_flags = fcntl (session->socket_fd, F_GETFL);
66 if ( -1 == fd_flags 70 if ( -1 == fd_flags
67 || 0 != fcntl (session->socket_fd, F_SETFL, fd_flags | O_NONBLOCK)) 71 || 0 != fcntl (session->socket_fd, F_SETFL, fd_flags | O_NONBLOCK))
68 {
69 SPDYF_DEBUG("WARNING: Couldn't set the new connection to be non-blocking"); 72 SPDYF_DEBUG("WARNING: Couldn't set the new connection to be non-blocking");
70 } 73
74 if(SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags)
75 {
76 ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val));
77 if(-1 == ret)
78 SPDYF_DEBUG("WARNING: Couldn't set the new connection to TCP_NODELAY");
79 }
71 80
72 return SPDY_YES; 81 return SPDY_YES;
73} 82}