diff options
author | Timo Sirainen <cras@irssi.org> | 2001-12-14 01:54:12 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-12-14 01:54:12 +0000 |
commit | 6774b4b30f0b43fc7c9942bf4f4f39c953b5ef6e (patch) | |
tree | c6e4846117c6eb1fe83bcd3cdeeac4160eca037d /src/irc | |
parent | ebd09ede510701de8782319ff47511abf55eddff (diff) | |
download | irssi-6774b4b30f0b43fc7c9942bf4f4f39c953b5ef6e.zip |
Added reference counting to server record. At least now we don't accidentally
use a destroyed server record when some /command disconnects the server
(shouldn't happen really) or when irc_send_cmd() fails sending data to server
and disconnects the server (I don't know if this ever happens, but if it does,
it very well could have caused crashes)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2243 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index d24fb801..f5aea94c 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -375,14 +375,15 @@ static void irc_parse_incoming(SERVER_REC *server) too slowly, so read only a few times from the socket before letting other tasks to run. */ count = 0; - while (irc_receive_line(server, &str, count < MAX_SOCKET_READS) > 0) { + server_ref(server); + 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); count++; - if (g_slist_find(servers, server) == NULL) - break; /* disconnected */ } + server_unref(server); } static void irc_init_server(IRC_SERVER_REC *server) |