From 897aa03814aab84bae0c3da05506df6687f0e4d5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 9 Jan 2002 17:00:45 +0000 Subject: irc_send_cmd() now doesn't call server_disconnect(), but rather just mark the connection_lost to TRUE, the disconnection is after the "server incoming" signal is finished. Changed irc_parse_incoming() back to not handling any commands in server's input buffer after server_disconnect() is called, it's not safe enough. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2299 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/irc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index f2827132..7757db84 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -52,7 +52,9 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, g_return_if_fail(server != NULL); g_return_if_fail(cmd != NULL); - if (server->disconnected) return; + + if (server->connection_lost) + return; len = strlen(cmd); server->cmdcount++; @@ -83,7 +85,6 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, if (net_sendbuffer_send(server->handle, cmd, len) == -1) { /* something bad happened */ server->connection_lost = TRUE; - server_disconnect(SERVER(server)); return; } @@ -376,10 +377,14 @@ static void irc_parse_incoming(SERVER_REC *server) letting other tasks to run. */ count = 0; server_ref(server); - while (irc_receive_line(server, &str, count < MAX_SOCKET_READS) > 0) { + while (!server->disconnected && + irc_receive_line(server, &str, count < MAX_SOCKET_READS) > 0) { rawlog_input(server->rawlog, str); signal_emit_id(signal_server_incoming, 2, server, str); + if (server->connection_lost) + server_disconnect(server); + count++; } server_unref(server); -- cgit v1.2.3