Index: src/mapping-protocol.c
===================================================================
--- src/mapping-protocol.c	(revision 2101)
+++ src/mapping-protocol.c	(working copy)
@@ -870,11 +870,12 @@ mapping_protocol_channel_dispatch_unlock
 	gsize     bytes;
 	GError   *error;
 
-	status = G_IO_STATUS_NORMAL;
-	if (channel->write_buffer->len > MINIMUM_MESSAGE_SIZE) {
+	status = G_IO_STATUS_AGAIN;
+	while (status == G_IO_STATUS_AGAIN) {
 		DEBUG_PRINT ("Dispatching messages");
 
 		error = NULL;
+		bytes = 0;
 		status = g_io_channel_write_chars (channel->iochannel,
 						   channel->write_buffer->str,
 						   channel->write_buffer->len,
@@ -883,7 +884,9 @@ mapping_protocol_channel_dispatch_unlock
 
 		channel->write_buffer = g_string_erase (channel->write_buffer, 0, bytes);
 
-		if (status != G_IO_STATUS_NORMAL) {
+		if (status == G_IO_STATUS_AGAIN) {
+			DEBUG_PRINT ("Resource temporarily unavailable - trying again");
+		} else if (status != G_IO_STATUS_NORMAL) {
 			DEBUG_PRINT ("Write error: %s", error->message);
 			g_error_free (error);
 		} else {
