diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-11 04:54:07 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-11 04:55:34 +0200 |
commit | f2a6c0f29964e6f531c10f935288419c6a57f2ea (patch) | |
tree | 3d37e2ef7221513ce40921c7dc276b7330b02771 | |
parent | d27a23a7d6ad3f5b35967cfecf64a4ebfa4b31c6 (diff) | |
download | xK-f2a6c0f29964e6f531c10f935288419c6a57f2ea.tar.gz xK-f2a6c0f29964e6f531c10f935288419c6a57f2ea.tar.xz xK-f2a6c0f29964e6f531c10f935288419c6a57f2ea.zip |
degesch: log disconnection in all buffers
-rw-r--r-- | degesch.c | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -3517,10 +3517,9 @@ initiate_quit (struct app_context *ctx) // Destroy the user interface input_stop (&ctx->input); + // Initiate a connection close struct str_map_iter iter; str_map_iter_init (&iter, &ctx->servers); - - // Initiate a connection close struct server *s; while ((s = str_map_iter_next (&iter))) { @@ -3541,11 +3540,8 @@ initiate_quit (struct app_context *ctx) } 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 && s->transport->cleanup) s->transport->cleanup (s); @@ -3560,11 +3556,11 @@ irc_disconnect (struct server *s) str_reset (&s->read_buffer); str_reset (&s->write_buffer); +} - // All of our timers have lost their meaning now - irc_cancel_timers (s); - - // Reset state bound to the connection +static void +irc_destroy_state (struct server *s) +{ struct str_map_iter iter; str_map_iter_init (&iter, &s->irc_channels); struct channel *channel; @@ -3588,6 +3584,22 @@ irc_disconnect (struct server *s) server_free_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 if (s->ctx->quitting) |