From 12968ba98642bd7057e8e7f41e184ab2d61671ed Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 3 May 2018 12:10:02 +0200 Subject: lib: Make UNIX socket buffer size configurable This makes the buffer size used by the UNIX sockets configurable. In case of a lot of IPCPs in the system it might become too small with the default value, resulting in irm command failures. The user can now easily configure it with an adequate value. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- src/irmd/ipcp.c | 4 ++-- src/irmd/main.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/irmd') diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index 49bf13c9..dc8f1c6e 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -53,7 +53,7 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t pid, ipcp_msg_t * msg) { int sockfd = 0; - uint8_t buf[IPCP_MSG_BUF_SIZE]; + uint8_t buf[SOCK_BUF_SIZE]; char * sock_path = NULL; ssize_t len; ipcp_msg_t * recv_msg = NULL; @@ -116,7 +116,7 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t pid, ipcp_msg__pack(msg, buf); if (write(sockfd, buf, len) != -1) - len = read(sockfd, buf, IPCP_MSG_BUF_SIZE); + len = read(sockfd, buf, SOCK_BUF_SIZE); if (len > 0) recv_msg = ipcp_msg__unpack(NULL, len, buf); diff --git a/src/irmd/main.c b/src/irmd/main.c index db9d7bbd..b2a521d5 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -68,7 +68,7 @@ #define IRMD_CLEANUP_TIMER ((IRMD_FLOW_TIMEOUT / 20) * MILLION) /* ns */ #define SHM_SAN_HOLDOFF 1000 /* ms */ #define IPCP_HASH_LEN(e) hash_len(e->dir_hash_algo) -#define IB_LEN IRM_MSG_BUF_SIZE +#define IB_LEN SOCK_BUF_SIZE enum init_state { IPCP_NULL = 0, @@ -1862,7 +1862,7 @@ static void * acceptloop(void * o) break; } - cmd->len = read(csockfd, cmd->cbuf, IRM_MSG_BUF_SIZE); + cmd->len = read(csockfd, cmd->cbuf, SOCK_BUF_SIZE); if (cmd->len <= 0) { log_err("Failed to read from socket."); close(csockfd); -- cgit v1.2.3