summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-06-04 22:45:54 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-06-04 22:45:54 +0200
commit86d9cb1e4157845405227f83a0318c912cd40532 (patch)
tree805312ad5320b2b8e07b32d92bf9496a8953a1e5 /src/plugins
parentb4dadd6d988e6e63890d6d7da46fe16d9ea56cd4 (diff)
downloadweechat-86d9cb1e4157845405227f83a0318c912cd40532.zip
relay: set socket option SO_REUSEADDR only for TCP sockets (issue #733)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/relay/relay-server.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c
index c15fbff06..d130ad5d2 100644
--- a/src/plugins/relay/relay-server.c
+++ b/src/plugins/relay/relay-server.c
@@ -445,16 +445,19 @@ relay_server_sock_cb (const void *pointer, void *data, int fd)
fcntl (client_fd, F_SETFL, flags | O_NONBLOCK);
/* set socket option SO_REUSEADDR */
- set = 1;
- if (setsockopt (client_fd, SOL_SOCKET, SO_REUSEADDR,
- (void *) &set, sizeof (set)) < 0)
+ if (!server->unix_socket)
{
- weechat_printf (NULL,
- _("%s%s: cannot set socket option \"%s\" to %d: "
- "error %d %s"),
- weechat_prefix ("error"), RELAY_PLUGIN_NAME,
- "SO_REUSEADDR", set, errno, strerror (errno));
- goto error;
+ set = 1;
+ if (setsockopt (client_fd, SOL_SOCKET, SO_REUSEADDR,
+ (void *) &set, sizeof (set)) < 0)
+ {
+ weechat_printf (NULL,
+ _("%s%s: cannot set socket option \"%s\" to %d: "
+ "error %d %s"),
+ weechat_prefix ("error"), RELAY_PLUGIN_NAME,
+ "SO_REUSEADDR", set, errno, strerror (errno));
+ goto error;
+ }
}
/* add the client */