summaryrefslogtreecommitdiff
path: root/src/plugins/relay/relay-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/relay/relay-server.c')
-rw-r--r--src/plugins/relay/relay-server.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c
index d130ad5d2..beccb8599 100644
--- a/src/plugins/relay/relay-server.c
+++ b/src/plugins/relay/relay-server.c
@@ -444,7 +444,7 @@ relay_server_sock_cb (const void *pointer, void *data, int fd)
flags = 0;
fcntl (client_fd, F_SETFL, flags | O_NONBLOCK);
- /* set socket option SO_REUSEADDR */
+ /* set socket option SO_REUSEADDR (only for TCP socket) */
if (!server->unix_socket)
{
set = 1;
@@ -621,19 +621,22 @@ relay_server_create_socket (struct t_relay_server *server)
}
#endif
- /* set option SO_REUSEADDR to 1 */
- set = 1;
- if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
- (void *) &set, sizeof (set)) < 0)
+ /* set option SO_REUSEADDR to 1 (only for TCP socket) */
+ 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));
- close (server->sock);
- server->sock = -1;
- return 0;
+ set = 1;
+ if (setsockopt (server->sock, 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));
+ close (server->sock);
+ server->sock = -1;
+ return 0;
+ }
}
/* set option SO_KEEPALIVE to 1 */