Enable TCP_NODELAY.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 22 Jul 2013 14:56:27 +0000 (23:56 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 23 Jul 2013 07:18:41 +0000 (16:18 +0900)
Change-Id: I847191cd99c1495b60f9c246a1d453c4ac00ac24

src/com-core_packet-router.c
src/secure_socket.c

index 056e0f2..57f45d0 100644 (file)
@@ -314,7 +314,7 @@ static inline struct request_ctx *create_request_ctx(int handle)
  * \NOTE
  * Running thread: Main
  */
-static inline struct router *find_router_by_handle(int handle)
+static struct router *find_router_by_handle(int handle)
 {
        struct dlist *l;
        struct router *router;
index 6217bb7..98185c7 100644 (file)
@@ -25,6 +25,7 @@
 #include <arpa/inet.h>
 #include <sys/un.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <errno.h>
 
 #include <dlog.h>
@@ -109,6 +110,12 @@ EAPI int secure_socket_create_client(const char *peer)
                DbgPrint("sndbuf: %d\n", sndbuf);
        }
 
+       if (setsockopt(handle, IPPROTO_IP, TCP_NODELAY, &on, sizeof(on)) < 0) {
+               ErrPrint("Failed to change rcvbuf size: %s\n", strerror(errno));
+       } else {
+               DbgPrint("TCP_NODELAY: %d\n", on);
+       }
+
        return handle;
 }
 
@@ -188,6 +195,12 @@ EAPI int secure_socket_get_connection_handle(int server_handle)
                DbgPrint("sndbuf: %d\n", sndbuf);
        }
 
+       if (setsockopt(handle, IPPROTO_IP, TCP_NODELAY, &on, sizeof(on)) < 0) {
+               ErrPrint("Failed to change rcvbuf size: %s\n", strerror(errno));
+       } else {
+               DbgPrint("TCP_NODELAY: %d\n", on);
+       }
+
        return handle;
 }