aboutsummaryrefslogtreecommitdiffhomepage
path: root/events.c
diff options
context:
space:
mode:
authorGravatar Rob <rob.manea@gmail.com>2009-11-06 16:15:08 +0100
committerGravatar Rob <rob.manea@gmail.com>2009-11-06 16:15:08 +0100
commit46714f503dacbb294d1e716de97cf1e2523f1424 (patch)
treeb0c35253a5ada82ab8dfe22e49f524727db8e945 /events.c
parent367dcb12c1a325bdedb736753650375534fbdb70 (diff)
fix approach to event sending
Diffstat (limited to 'events.c')
-rw-r--r--events.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/events.c b/events.c
index 696596b..2663091 100644
--- a/events.c
+++ b/events.c
@@ -80,25 +80,22 @@ send_event_socket(GString *msg) {
tmp->str, tmp->len,
&len, &error);
- if (ret == G_IO_STATUS_ERROR) {
+ if (ret == G_IO_STATUS_ERROR)
g_warning ("Error sending event to socket: %s", error->message);
- }
- g_io_channel_flush(gio, &error);
+ else
+ g_io_channel_flush(gio, &error);
}
}
if(msg) {
- while(!ret ||
- ret == G_IO_STATUS_AGAIN) {
- ret = g_io_channel_write_chars (gio,
- msg->str, msg->len,
- &len, &error);
- }
+ ret = g_io_channel_write_chars (gio,
+ msg->str, msg->len,
+ &len, &error);
- if (ret == G_IO_STATUS_ERROR) {
+ if (ret == G_IO_STATUS_ERROR)
g_warning ("Error sending event to socket: %s", error->message);
- }
- g_io_channel_flush(gio, &error);
+ else
+ g_io_channel_flush(gio, &error);
}
}
}
@@ -124,15 +121,14 @@ send_event_socket(GString *msg) {
ret = 0;
if(gio && gio->is_writeable && msg) {
- while(!ret || ret == G_IO_STATUS_AGAIN) {
- ret = g_io_channel_write_chars (gio,
- msg->str, msg->len,
- &len, &error);
- }
+ ret = g_io_channel_write_chars (gio,
+ msg->str, msg->len,
+ &len, &error);
if (ret == G_IO_STATUS_ERROR)
g_warning ("Error sending event to socket: %s", error->message);
- g_io_channel_flush(gio, &error);
+ else
+ g_io_channel_flush(gio, &error);
}
}
}