From 9462d1a97faa8929a4fdc642886de1a12933b7e0 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 18 May 2016 23:48:06 +0200 Subject: [PATCH] protocol: Added infinite lingering --- src/protocol/connect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/protocol/connect.c b/src/protocol/connect.c index dc321be..8d365fc 100644 --- a/src/protocol/connect.c +++ b/src/protocol/connect.c @@ -40,6 +40,8 @@ int bind_server(void) { if (sock < 0) return -1; + nn_setsockopt(sock, NN_SOL_SOCKET, NN_LINGER, &(int) {-1}, sizeof (int)); + if (nn_bind(sock, URL) < 0) goto error; @@ -58,6 +60,8 @@ int connect_client(void) { if (sock < 0) return -1; + nn_setsockopt(sock, NN_SOL_SOCKET, NN_LINGER, &(int) {-1}, sizeof (int)); + if (nn_connect (sock, URL) < 0) goto error;