]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
01_DCCP_shutdown-unnecessary.diff
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Mon, 17 Dec 2007 12:12:25 +0000 (13:12 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 17 Dec 2007 12:12:25 +0000 (13:12 +0100)
This calls shutdown(2) for unused communication paths in the DCCP sender/receiver:
 * the sender does not read data from the client and so calls shutdown(SHUT_RD);
 * the client does not send data to the server and so calls shutdown(SHUT_WR).
The advantage that this buys is a performance optimisation: using shutdown(2) in
DCCP means disabling the corresponding CCID kernel modules, which reduces the
processing costs, i.e.
 * when using SHUT_RD, the receiver congestion-control module is de-activated;
 * when using SHUT_WR, the sender congestion-control module is de-activated.

More information can be found on
http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/shutdown/

dccp_recv.c
dccp_send.c

index eeb7c57a71a52ea26cdeb1ee8751939a6b2518f7..c0618602571975fbb6ab17b80f633eb8d33aaca0 100644 (file)
@@ -61,6 +61,13 @@ static int dccp_recv_open(struct receiver_node *rn)
 
        if (ret < 0)
                return ret;
+       /*
+        * Disable unused CCIDs: the receiver does not send any application data to the
+        * server. By shutting down this unused path we reduce internal processing costs,
+        * as the unused CCIDs (in the kernel) are then bypassed.
+        */
+       if (shutdown(ret, SHUT_WR) < 0)
+               return -ERRNO_TO_PARA_ERROR(errno);
 
        rn->buf = para_calloc(DCCP_BUFSIZE);
        rn->private_data = pdd = para_calloc(sizeof(struct private_dccp_recv_data));
index 5d8e6593fe0bffd5b628fe92eeffac8d9638c90a..f3b9120b3dfd75ef913a1d4b1f6a2b968e887ba1 100644 (file)
@@ -72,6 +72,15 @@ static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds)
                PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
                return;
        }
+       /*
+        * Bypass unused CCID paths: the sender does not receive application data
+        * from the client; by shutting down this unused communication path we can
+        * reduce processing costs a bit. See analogous comment in dccp_recv.c.
+        */
+       if (shutdown(ret, SHUT_RD) < 0) {
+               PARA_ERROR_LOG("shutdown(SHUT_RD): %s\n", strerror(errno));
+               return;
+       }
        dc = para_calloc(sizeof(struct dccp_client));
        dc->fd = ret;
        dc->name = make_message("%s", remote_name(dc->fd));