diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-09-18 09:36:50 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-09-18 09:36:50 +0200 |
commit | 5b04d4123c810d7c8c245ac088dcf1c79a5f6cf0 (patch) | |
tree | cd2388c7037a2ccfdfbcd8e70b8dfda676470126 /src | |
parent | 43cc44abca0768ce2ad1e804a0daa62b4ce81dfc (diff) | |
download | weechat-5b04d4123c810d7c8c245ac088dcf1c79a5f6cf0.zip |
Close relay server sockets on /upgrade
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/relay/relay-server.c | 17 | ||||
-rw-r--r-- | src/plugins/relay/relay.c | 8 | ||||
-rw-r--r-- | src/plugins/relay/relay.h | 2 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c index a02ef474d..7e04aa818 100644 --- a/src/plugins/relay/relay-server.c +++ b/src/plugins/relay/relay-server.c @@ -142,13 +142,16 @@ relay_server_close_socket (struct t_relay_server *server) { close (server->sock); server->sock = -1; - - weechat_printf (NULL, - _("%s: socket closed for %s.%s (port %d)"), - RELAY_PLUGIN_NAME, - relay_protocol_string[server->protocol], - server->protocol_string, - server->port); + + if (!relay_signal_upgrade_received) + { + weechat_printf (NULL, + _("%s: socket closed for %s.%s (port %d)"), + RELAY_PLUGIN_NAME, + relay_protocol_string[server->protocol], + server->protocol_string, + server->port); + } } } diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index 6fa4a19d6..062866588 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -79,6 +79,8 @@ int relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data, void *signal_data) { + struct t_relay_server *ptr_server; + /* make C compiler happy */ (void) data; (void) signal; @@ -87,6 +89,12 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data, relay_signal_upgrade_received = 1; + for (ptr_server = relay_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + relay_server_close_socket (ptr_server); + } + return WEECHAT_RC_OK; } diff --git a/src/plugins/relay/relay.h b/src/plugins/relay/relay.h index 533a0b370..b6a3adbe8 100644 --- a/src/plugins/relay/relay.h +++ b/src/plugins/relay/relay.h @@ -25,6 +25,8 @@ extern struct t_weechat_plugin *weechat_relay_plugin; +extern int relay_signal_upgrade_received; + /* relay protocol */ enum t_relay_protocol |