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
This commit is contained in:
Timo Sirainen 2001-12-14 01:54:12 +00:00 committed by cras
commit 6774b4b30f
7 changed files with 64 additions and 17 deletions

View file

@ -3,6 +3,8 @@
int type; /* module_get_uniq_id("SERVER", 0) */
int chat_type; /* chat_protocol_lookup(xx) */
int refcount;
STRUCT_SERVER_CONNECT_REC *connrec;
time_t connect_time; /* connection time */
time_t real_connect_time; /* time when server replied that we really are connected */
@ -10,7 +12,8 @@ time_t real_connect_time; /* time when server replied that we really are connect
char *tag; /* tag name for addressing server */
char *nick; /* current nick */
unsigned int connected:1; /* connected to server */
unsigned int connected:1; /* Connected to server */
unsigned int disconnected:1; /* Disconnected, waiting for refcount to drop zero */
unsigned int connection_lost:1; /* Connection lost unintentionally */
unsigned int session_reconnect:1; /* Connected to this server with /UPGRADE */
unsigned int no_reconnect:1; /* Don't reconnect to server */