changeset 2300:d2686f757d6e

[gaim-migrate @ 2310] neat things. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 17 Sep 2001 21:30:47 +0000
parents b5b7dece5249
children 171d11fb37b9
files src/protocols/jabber/jabber.c src/proxy.c
diffstat 2 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Mon Sep 17 19:22:21 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Mon Sep 17 21:30:47 2001 +0000
@@ -424,14 +424,14 @@
 	jd = gc->proto_data;
 	j = jd->jc;
 
+	if (j->fd != source)
+		j->fd = source;
+
 	if (source == -1) {
 		STATE_EVT(JCONN_STATE_OFF)
 		return;
 	}
 
-	if (j->fd != source)
-		j->fd = source;
-
 	j->state = JCONN_STATE_CONNECTED;
 	STATE_EVT(JCONN_STATE_CONNECTED)
 
@@ -1216,7 +1216,8 @@
 	struct jabber_data *jd = gc->proto_data;
 	g_hash_table_foreach_remove(jd->hash, jabber_destroy_hash, NULL);
 	g_hash_table_destroy(jd->hash);
-	gaim_input_remove(gc->inpa);
+	if (gc->inpa)
+		gaim_input_remove(gc->inpa);
 	close(jd->jc->fd);
 	g_timeout_add(50, jabber_free, jd->jc);
 	jd->jc = NULL;
--- a/src/proxy.c	Mon Sep 17 19:22:21 2001 +0000
+++ b/src/proxy.c	Mon Sep 17 21:30:47 2001 +0000
@@ -58,6 +58,7 @@
 
 typedef struct _GaimIOClosure {
 	GaimInputFunction function;
+	guint result;
 	gpointer data;
 } GaimIOClosure;
 
@@ -76,6 +77,9 @@
 	if (condition & GAIM_READ_COND)
 		gaim_cond |= GAIM_INPUT_WRITE;
 
+	debug_printf("CLOSURE: callback for %d, fd is %d\n",
+			closure->result, g_io_channel_unix_get_fd(source));
+
 	closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
 
 	return TRUE;
@@ -84,7 +88,6 @@
 gint gaim_input_add(gint source, GaimInputCondition condition,
 		GaimInputFunction function, gpointer data)
 {
-	guint result;
 	GaimIOClosure *closure = g_new0(GaimIOClosure, 1);
 	GIOChannel *channel;
 	GIOCondition cond = 0;
@@ -98,14 +101,18 @@
 		cond |= GAIM_WRITE_COND;
 
 	channel = g_io_channel_unix_new(source);
-	result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
+	closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
 				     gaim_io_invoke, closure, gaim_io_destroy);
+
+	debug_printf("CLOSURE: adding input watcher %d for fd %d\n", closure->result, source);
+
 	g_io_channel_unref(channel);
-	return result;
+	return closure->result;
 }
 
 void gaim_input_remove(gint tag)
 {
+	debug_printf("CLOSURE: removing input watcher %d\n", tag);
 	g_source_remove(tag);
 }