degesch: log disconnection in all buffers

This commit is contained in:
Přemysl Eric Janouch 2015-07-11 04:54:07 +02:00
parent d27a23a7d6
commit f2a6c0f299
1 changed files with 22 additions and 10 deletions

View File

@ -3517,10 +3517,9 @@ initiate_quit (struct app_context *ctx)
// Destroy the user interface // Destroy the user interface
input_stop (&ctx->input); input_stop (&ctx->input);
// Initiate a connection close
struct str_map_iter iter; struct str_map_iter iter;
str_map_iter_init (&iter, &ctx->servers); str_map_iter_init (&iter, &ctx->servers);
// Initiate a connection close
struct server *s; struct server *s;
while ((s = str_map_iter_next (&iter))) while ((s = str_map_iter_next (&iter)))
{ {
@ -3541,11 +3540,8 @@ initiate_quit (struct app_context *ctx)
} }
static void static void
irc_disconnect (struct server *s) irc_destroy_transport (struct server *s)
{ {
hard_assert (irc_is_connected (s));
// Get rid of the dead socket
if (s->transport if (s->transport
&& s->transport->cleanup) && s->transport->cleanup)
s->transport->cleanup (s); s->transport->cleanup (s);
@ -3560,11 +3556,11 @@ irc_disconnect (struct server *s)
str_reset (&s->read_buffer); str_reset (&s->read_buffer);
str_reset (&s->write_buffer); str_reset (&s->write_buffer);
}
// All of our timers have lost their meaning now static void
irc_cancel_timers (s); irc_destroy_state (struct server *s)
{
// Reset state bound to the connection
struct str_map_iter iter; struct str_map_iter iter;
str_map_iter_init (&iter, &s->irc_channels); str_map_iter_init (&iter, &s->irc_channels);
struct channel *channel; struct channel *channel;
@ -3588,6 +3584,22 @@ irc_disconnect (struct server *s)
server_free_specifics (s); server_free_specifics (s);
server_init_specifics (s); server_init_specifics (s);
}
static void
irc_disconnect (struct server *s)
{
hard_assert (irc_is_connected (s));
struct str_map_iter iter;
str_map_iter_init (&iter, &s->irc_buffer_map);
struct buffer *buffer;
while ((buffer = str_map_iter_next (&iter)))
log_server_status (s, buffer, "Disconnected from server");
irc_cancel_timers (s);
irc_destroy_transport (s);
irc_destroy_state (s);
// Take any relevant actions // Take any relevant actions
if (s->ctx->quitting) if (s->ctx->quitting)