[xiph-cvs] cvs commit: net sock.c sock.h

Michael Smith msmith at xiph.org
Fri Jan 17 23:08:00 PST 2003



msmith      03/01/18 02:08:00

  Modified:    src      connection.c fserve.c
               .        sock.c sock.h
  Log:
  Set TCP_NODELAY on sockets for streams and fileserving.
  
  Adapted from a patch sent by Richard Galli

Revision  Changes    Path
1.39      +1 -0      icecast/src/connection.c

Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- connection.c	31 Dec 2002 07:49:34 -0000	1.38
+++ connection.c	18 Jan 2003 07:08:00 -0000	1.39
@@ -770,6 +770,7 @@
         if(bytes > 0) client->con->sent_bytes += bytes;
                                                         
             sock_set_blocking(client->con->sock, SOCK_NONBLOCK);
+        sock_set_nodelay(client->con->sock);
                                                 
                 avl_tree_wlock(source->pending_tree);
                 avl_insert(source->pending_tree, (void *)client);

<p><p>1.8       +1 -0      icecast/src/fserve.c

Index: fserve.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/fserve.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- fserve.c	29 Dec 2002 15:46:32 -0000	1.7
+++ fserve.c	18 Jan 2003 07:08:00 -0000	1.8
@@ -380,6 +380,7 @@
     if(bytes > 0) httpclient->con->sent_bytes = bytes;
 
     sock_set_blocking(client->client->con->sock, SOCK_NONBLOCK);
+    sock_set_nodelay(client->client->con->sock);
 
     avl_tree_wlock(pending_tree);
     avl_insert(pending_tree, client);

<p><p>1.10      +9 -0      net/sock.c

Index: sock.c
===================================================================
RCS file: /usr/local/cvsroot/net/sock.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sock.c	1 Dec 2002 02:11:07 -0000	1.9
+++ sock.c	18 Jan 2003 07:08:00 -0000	1.10
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <sys/time.h>
 #include <netdb.h>
@@ -198,6 +199,14 @@
         struct linger lin = { 0, 0 };
         return setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *)&lin, 
             sizeof(struct linger));
+}
+
+int sock_set_nodelay(sock_t sock)
+{
+    int nodelay = 1;
+
+    return setsockopt(sock, SOL_TCP, TCP_NODELAY, (void *)nodelay,
+            sizeof(int));
 }
 
 int sock_set_keepalive(sock_t sock)

<p><p>1.9       +1 -0      net/sock.h

Index: sock.h
===================================================================
RCS file: /usr/local/cvsroot/net/sock.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- sock.h	1 Dec 2002 02:11:07 -0000	1.8
+++ sock.h	18 Jan 2003 07:08:00 -0000	1.9
@@ -66,6 +66,7 @@
 int sock_set_blocking(sock_t sock, const int block);
 int sock_set_nolinger(sock_t sock);
 int sock_set_keepalive(sock_t sock);
+int sock_set_nodelay(sock_t sock);
 int sock_close(sock_t  sock);
 
 /* Connection related socket functions */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list