- PARA_NOTICE_LOG("connection from %s\n", inet_ntoa(dc->addr.sin_addr));
- dc->fd = ret;
- list_add(&dc->node, &clients);
+ fd = ret;
+ /*
+ * 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(fd, SHUT_RD) < 0) {
+ PARA_ERROR_LOG("shutdown(SHUT_RD): %s\n", strerror(errno));
+ goto err;
+ }
+ ret = mark_fd_nonblocking(fd);
+ if (ret < 0) {
+ PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+ goto err;
+ }
+ dc = para_calloc(sizeof(struct dccp_client));
+ dc->fd = fd;
+ dc->name = make_message("%s", remote_name(dc->fd));
+ PARA_NOTICE_LOG("connection from %s\n", dc->name);
+ para_list_add(&dc->node, &clients);
+ add_close_on_fork_list(dc->fd);
+ dc->cq = cq_new(DCCP_MAX_PENDING_BYTES);
+ return;
+err:
+ close(fd);