From 05731ea83c1e4ff0b1a39b55207082fecd4ed831 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 13 Jun 2016 21:14:01 +0200 Subject: [PATCH] [handle] be consistent in applying sockopts around Signed-off-by: Fabio M. Di Nitto --- libknet/handle.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libknet/handle.c b/libknet/handle.c index 262294d..bd3c396 100644 --- a/libknet/handle.c +++ b/libknet/handle.c @@ -180,6 +180,30 @@ static int _init_socketpair(knet_handle_t knet_h, int *sock0, int *sock1) goto exit_fail; } + value = KNET_RING_RCVBUFF; + if (setsockopt(*sock0, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0) { + savederrno = errno; + log_err(knet_h, KNET_SUB_HANDLE, "Unable to set send buffer on sock[0]: %s", + strerror(savederrno)); + goto exit_fail; + } + + value = KNET_RING_RCVBUFF; + if (setsockopt(*sock1, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0) { + savederrno = errno; + log_err(knet_h, KNET_SUB_HANDLE, "Unable to set receive buffer on sock[1]: %s", + strerror(savederrno)); + goto exit_fail; + } + + value = KNET_RING_RCVBUFF; + if (setsockopt(*sock1, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0) { + savederrno = errno; + log_err(knet_h, KNET_SUB_HANDLE, "Unable to set send buffer on sock[1]: %s", + strerror(savederrno)); + goto exit_fail; + } + return 0; exit_fail: -- 2.39.5