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/
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));
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));