summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-12 14:57:22 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-12 16:14:16 +0100
commitb2454c106703d31b8d352ff544f5a3d94dd6b048 (patch)
tree537700e127b337a2589fa4ba1515fbfdb0cd7315
parent8a60170924271a53a11143ff6a266cf09d0710d3 (diff)
gtk: simplify debugging of coroutine-related path
-rw-r--r--gtk/channel-cursor.c7
-rw-r--r--gtk/channel-display.c7
-rw-r--r--gtk/channel-inputs.c7
-rw-r--r--gtk/channel-main.c7
-rw-r--r--gtk/channel-playback.c7
-rw-r--r--gtk/channel-record.c8
-rw-r--r--gtk/gio-coroutine.c6
-rw-r--r--gtk/gio-coroutine.h2
-rw-r--r--gtk/spice-channel-priv.h8
-rw-r--r--gtk/spice-channel.c19
-rw-r--r--gtk/spice-pulse.c2
11 files changed, 23 insertions, 57 deletions
diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index 4ef585c..152c386 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -226,13 +226,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
/* ------------------------------------------------------------------ */
static void mono_cursor(display_cursor *cursor, const guint8 *data)
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 5a7ee81..a9f388b 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -275,13 +275,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
/* ------------------------------------------------------------------ */
static void image_put(SpiceImageCache *cache, uint64_t id, pixman_image_t *image)
diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c
index 7380af3..8eaf7bb 100644
--- a/gtk/channel-inputs.c
+++ b/gtk/channel-inputs.c
@@ -164,13 +164,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
/* ------------------------------------------------------------------ */
static spice_msg_out* mouse_motion(SpiceInputsChannel *channel)
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index a60d397..9850ac6 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -506,13 +506,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
/* ------------------------------------------------------------------ */
/* coroutine context */
diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index 08f0fb4..22c6ba4 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -226,13 +226,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
/* ------------------------------------------------------------------ */
/* coroutine context */
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index 382ff40..c7f7054 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -186,14 +186,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
-
/* main context */
static void spice_record_mode(SpiceRecordChannel *channel, uint32_t time,
uint32_t mode, uint8_t *data, uint32_t data_size)
diff --git a/gtk/gio-coroutine.c b/gtk/gio-coroutine.c
index 9926dd0..5aa5716 100644
--- a/gtk/gio-coroutine.c
+++ b/gtk/gio-coroutine.c
@@ -157,6 +157,7 @@ struct signal_data
int signum;
gpointer params;
GSignalEmitMainFunc func;
+ const char *debug_info;
};
static gboolean emit_main_context(gpointer opaque)
@@ -173,7 +174,8 @@ static gboolean emit_main_context(gpointer opaque)
void g_signal_emit_main_context(GObject *object,
GSignalEmitMainFunc emit_main_func,
int signum,
- gpointer params)
+ gpointer params,
+ const char *debug_info)
{
struct signal_data data;
@@ -182,7 +184,7 @@ void g_signal_emit_main_context(GObject *object,
data.signum = signum;
data.params = params;
data.func = emit_main_func;
-
+ data.debug_info = debug_info;
g_idle_add(emit_main_context, &data);
/* This switches to the system coroutine context, lets
diff --git a/gtk/gio-coroutine.h b/gtk/gio-coroutine.h
index ea647ae..5f4221a 100644
--- a/gtk/gio-coroutine.h
+++ b/gtk/gio-coroutine.h
@@ -58,7 +58,7 @@ gboolean g_condition_wait (g_condition_wait_func func, gpointer data);
void g_io_wakeup (struct wait_queue *wait);
GIOCondition g_io_wait_interruptable(struct wait_queue *wait, GSocket *sock, GIOCondition cond);
void g_signal_emit_main_context(GObject *object, GSignalEmitMainFunc func,
- int signum, gpointer params);
+ int signum, gpointer params, const char *debug_info);
void g_object_notify_main_context(GObject *object, const gchar *property_name);
G_END_DECLS
diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h
index 1f26580..32ca652 100644
--- a/gtk/spice-channel-priv.h
+++ b/gtk/spice-channel-priv.h
@@ -133,6 +133,14 @@ void spice_channel_handle_disconnect(SpiceChannel *channel, spice_msg_in *in);
void spice_channel_handle_wait_for_channels(SpiceChannel *channel, spice_msg_in *in);
void spice_channel_handle_migrate(SpiceChannel *channel, spice_msg_in *in);
+/* coroutine context */
+#define emit_main_context(object, event, args...) \
+ G_STMT_START { \
+ g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
+ event, &((struct event) { args }), G_STRLOC); \
+ } G_STMT_END
+
+
G_END_DECLS
#endif /* __SPICE_CLIENT_CHANNEL_PRIV_H__ */
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 29300f4..309b89a 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -526,14 +526,6 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
}
}
-/* coroutine context */
-#define emit_main_context(object, event, args...) \
- G_STMT_START { \
- g_signal_emit_main_context(G_OBJECT(object), do_emit_main_context, \
- event, &((struct event) { args })); \
- } G_STMT_END
-
-
/*
* Write all 'data' of length 'datalen' bytes out to
* the wire
@@ -1186,7 +1178,12 @@ static gboolean spice_channel_iterate(SpiceChannel *channel)
ret = g_socket_condition_check(c->sock, G_IO_IN);
#endif
} while (ret == 0); /* ret == 0 means no IO condition, but woken up */
- /* TODO: check ret if error */
+
+ if (ret & (G_IO_ERR|G_IO_HUP)) {
+ SPICE_DEBUG("got socket error before read(): %d", ret);
+ c->has_error = TRUE;
+ return FALSE;
+ }
SPICE_CHANNEL_GET_CLASS(channel)->iterate_read(channel);
@@ -1217,7 +1214,7 @@ static void *spice_channel_coroutine(void *data)
spice_channel *c = channel->priv;
int ret;
- SPICE_DEBUG("Started background coroutine");
+ SPICE_DEBUG("Started background coroutine %p", &c->coroutine);
if (spice_session_get_client_provided_socket(c->session)) {
if (c->fd < 0) {
@@ -1319,7 +1316,7 @@ static gboolean connect_delayed(gpointer data)
spice_channel *c = channel->priv;
struct coroutine *co;
- SPICE_DEBUG("Open coroutine starting");
+ SPICE_DEBUG("Open coroutine starting %p", channel);
c->connect_delayed_id = 0;
co = &c->coroutine;
diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index 3426f87..be8efa6 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -580,9 +580,11 @@ static void channel_event(SpiceChannel *channel, SpiceChannelEvent event,
break;
case SPICE_CHANNEL_CLOSED:
if (channel == p->pchannel) {
+ SPICE_DEBUG("playback closed");
p->pchannel = NULL;
g_object_unref(channel);
} else if (channel == p->rchannel) {
+ SPICE_DEBUG("record closed");
record_stop(SPICE_RECORD_CHANNEL(channel), pulse);
p->rchannel = NULL;
g_object_unref(channel);