aboutsummaryrefslogtreecommitdiff
path: root/src/util/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/network.c')
-rw-r--r--src/util/network.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util/network.c b/src/util/network.c
index 0446d649c..b0669b5b1 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -722,6 +722,30 @@ GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc, int how)
722 722
723 723
724/** 724/**
725 * Disable the "CORK" feature for communication with the given socket,
726 * forcing the OS to immediately flush the buffer on transmission
727 * instead of potentially buffering multiple messages. Essentially
728 * reduces the OS send buffers to zero.
729 *
730 * @param desc socket
731 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
732 */
733int
734GNUNET_NETWORK_socket_disable_corking (struct GNUNET_NETWORK_Handle *desc)
735{
736 int value = 0;
737 int ret = 0;
738
739 if (0 != (ret = setsockopt (desc->fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof (value))))
740 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
741 if (0 != (ret = setsockopt (desc->fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof (value))))
742 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
743
744 return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
745}
746
747
748/**
725 * Reset FD set 749 * Reset FD set
726 * @param fds fd set 750 * @param fds fd set
727 */ 751 */