Skip to content

Commit

Permalink
remote_wait_for_cancel: move pending check before poll()
Browse files Browse the repository at this point in the history
Otherwise it can still hang.
  • Loading branch information
markokr committed Jul 8, 2013
1 parent ec59150 commit 294e9a5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/execute.c
Expand Up @@ -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);
Expand All @@ -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 */
Expand Down

0 comments on commit 294e9a5

Please sign in to comment.