changeset 20852:1c4be30c9e9b

lib-program-client: Fixed program_client_run() that succeeds rapidly. program_client_run_async() could have called the callback with result=0 before io_loop_run(). This happened with local client. Fixes in test-program-client-local: Panic: BUG: No IOs or timeouts set. Not waiting for infinity.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 10 Oct 2016 21:19:34 +0300
parents c2c1190aa566
children ec2d92883d82
files src/lib-program-client/program-client.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-program-client/program-client.c	Mon Oct 10 23:53:55 2016 +0300
+++ b/src/lib-program-client/program-client.c	Mon Oct 10 21:19:34 2016 +0300
@@ -556,7 +556,7 @@
 
 int program_client_run(struct program_client *pclient)
 {
-	int ret = 0;
+	int ret = -2;
 	struct ioloop *prev_ioloop = current_ioloop;
 	struct ioloop *ioloop = io_loop_create();
 
@@ -564,7 +564,7 @@
 
 	program_client_run_async(pclient, program_client_run_callback, &ret);
 
-	if (ret == 0) {
+	if (ret == -2) {
 		io_loop_run(ioloop);
 	}