changeset 18701:d46270397a2f

replication plugin: Fixed handling EAGAIN errors when writing to replication-pipe.
author Timo Sirainen <tss@iki.fi>
date Fri, 15 May 2015 13:55:46 +0300
parents 7cf62f28fd62
children 917d027836d0
files src/plugins/replication/replication-plugin.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/replication/replication-plugin.c	Fri May 15 13:54:49 2015 +0300
+++ b/src/plugins/replication/replication-plugin.c	Fri May 15 13:55:46 2015 +0300
@@ -80,16 +80,16 @@
 	}
 	str_append_c(str, '\n');
 	ret = write(fifo_fd, str_data(str), str_len(str));
-	if (ret == 0) {
-		/* busy, try again later */
-		return 0;
-	}
+	i_assert(ret != 0);
 	if (ret != (ssize_t)str_len(str)) {
 		if (ret > 0)
 			i_error("write(%s) wrote partial data", fifo_path);
-		else if (errno != EPIPE)
+		else if (errno == EAGAIN) {
+			/* busy, try again later */
+			return 0;
+		} else if (errno != EPIPE) {
 			i_error("write(%s) failed: %m", fifo_path);
-		else {
+		} else {
 			/* server was probably restarted, don't bother logging
 			   this. */
 		}