summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2013-07-08 15:00:52 +0000
committerMarko Kreen2013-07-08 15:01:59 +0000
commit294e9a5fefb618b018e47b6b48d00593e0ed735a (patch)
treeb307dc2583a5b8e6cd34052ac7372c21214be81b
parentec59150b6085a21ac00ace40e15f80092650608d (diff)
remote_wait_for_cancel: move pending check before poll()
Otherwise it can still hang.
-rw-r--r--src/execute.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/execute.c b/src/execute.c
index 00d5c91..f0f1cc1 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -794,19 +794,15 @@ remote_wait_for_cancel(ProxyFunction *func)
ProxyConnection *conn;
ProxyCluster *cluster = func->cur_cluster;
int i,
- pending = 1;
+ pending;
struct timeval now;
/* now loop until all results are arrived */
- while (pending)
+ while (1)
{
/* allow postgres to cancel processing */
CHECK_FOR_INTERRUPTS();
- /* wait for events */
- if (poll_conns(func, cluster) == 0)
- continue;
-
/* recheck */
pending = 0;
gettimeofday(&now, NULL);
@@ -820,6 +816,11 @@ remote_wait_for_cancel(ProxyFunction *func)
pending++;
check_timeouts(func, cluster, conn, now.tv_sec);
}
+ if (!pending)
+ break;
+
+ /* wait for events */
+ poll_conns(func, cluster);
}
/* review results, calculate total */