Forgot to add handlers to list
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 05 Nov 2009 12:45:24 +0200
changeset 8 859e715adfcd
parent 7 c9ae7744e2f7
child 9 ff475b333e44
Forgot to add handlers to list
disco.c
--- a/disco.c	Mon Nov 02 21:42:15 2009 +0200
+++ b/disco.c	Thu Nov 05 12:45:24 2009 +0200
@@ -34,14 +34,14 @@
 #include "hbuf.h"
 #include "hooks.h"
 
-static GSList *disco_handlers = NULL;
+static GSList *reply_handlers = NULL;
 static guint   disco_cid      = 0;
 
 static LmHandlerResult disco_handler (LmMessageHandler *handler, LmConnection *connection, LmMessage *message, gpointer udata)
 {
 	int info_request = (int) udata;
 
-	disco_handlers = g_slist_remove (disco_handlers, handler);
+	reply_handlers = g_slist_remove (reply_handlers, handler);
 
 	switch (lm_message_get_sub_type (message)) {
 	case LM_MESSAGE_SUB_TYPE_RESULT:
@@ -199,6 +199,8 @@
 
 		handler = lm_message_handler_new (disco_handler, (gpointer) info, NULL);
 
+		reply_handlers = g_slist_append (reply_handlers, handler);
+
 		{ // create message
 			LmMessageNode *node;
 
@@ -227,14 +229,14 @@
 
 	if (lconnection) { // XXX more checks?
 		// let's hope, that after invalidation, lm will remove and free unreffed by us handler
-		for (hel = disco_handlers; hel; hel = hel->next) {
+		for (hel = reply_handlers; hel; hel = hel->next) {
 			LmMessageHandler *handler = (LmMessageHandler *) hel->data;
 			lm_message_handler_invalidate (handler);
 		}
 	}
 
-	g_slist_free (disco_handlers);
-	disco_handlers = NULL;
+	g_slist_free (reply_handlers);
+	reply_handlers = NULL;
 }
 
 // release handlers before reconnect
@@ -252,7 +254,7 @@
 
 const gchar *g_module_check_init(GModule *module)
 {
-	disco_handlers = NULL;
+	reply_handlers = NULL;
 
 	// completion
 	disco_cid = compl_new_category ();