summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2008-11-07 16:30:19 -0500
committerNathan Straz <nstraz@redhat.com>2008-11-07 16:30:19 -0500
commitc933857266f195142a5bcf790e9457b4985a2f50 (patch)
tree324d70c198f72c78197c40215972c92d97c1b7b0
parenta26a36dee721b375b78abf12004639a4688382af (diff)
downloadqarsh-c933857266f195142a5bcf790e9457b4985a2f50.tar.gz
qarsh-c933857266f195142a5bcf790e9457b4985a2f50.tar.xz
qarsh-c933857266f195142a5bcf790e9457b4985a2f50.zip
Don't wait until after the pselect to see if we're done.
All the actions which need to be done before we exit are done after the pselect. Waiting until after the next pselect can cause us to sit for a second before we exit, which slows down things which use qarsh.
-rw-r--r--qarsh.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/qarsh.c b/qarsh.c
index 31ff36a..2e43658 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -292,13 +292,7 @@ run_remote_cmd(char *cmdline)
&pselect_sigmask);
if (nset == 0) {
- if (cmd_finished && c_out == 0 && c_err == 0) {
- /* If the command is complete and both output
- * sockets are closed, we can exit now. We need
- * to test all conditions at once so if none are
- * true, we'll still check for heartbeat. */
- break;
- } else if (!hbeat(qarsh_hb)) {
+ if (!hbeat(qarsh_hb)) {
/* If the heartbeat fails, we should exit now.
* The hbeat state will take precedence over the
* exit status of the command. */
@@ -384,6 +378,13 @@ run_remote_cmd(char *cmdline)
nset--;
}
}
+ if (cmd_finished && c_out == 0 && c_err == 0) {
+ /* If the command is complete and both output
+ * sockets are closed, we can exit now. We need
+ * to test all conditions at once so if none are
+ * true, we'll still check for heartbeat. */
+ break;
+ }
}
if (c_out) close(c_out);
if (c_err) close(c_err);