diff options
author | Nathan Straz <nstraz@redhat.com> | 2008-11-07 16:30:19 -0500 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2008-11-07 16:30:19 -0500 |
commit | c933857266f195142a5bcf790e9457b4985a2f50 (patch) | |
tree | 324d70c198f72c78197c40215972c92d97c1b7b0 | |
parent | a26a36dee721b375b78abf12004639a4688382af (diff) | |
download | qarsh-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.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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); |