diff options
-rw-r--r-- | qarsh.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -147,6 +147,7 @@ run_remote_cmd(char *cmdline) struct sockaddr_in caddr; socklen_t clen; struct timespec timeout; + short cmd_finished; l_in = bind_any(QARSH_MINPORT); p_in = getsockport(l_in); @@ -225,9 +226,15 @@ run_remote_cmd(char *cmdline) buf = malloc(1024); memset(buf, 0, 1024); + cmd_finished = 0; for (;;) { - timeout.tv_sec = 5; - timeout.tv_nsec = 0; + if (cmd_finished) { + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + } else { + timeout.tv_sec = 5; + timeout.tv_nsec = 0; + } testfds = readfds; memset(buf, 0, 1024); @@ -242,6 +249,10 @@ run_remote_cmd(char *cmdline) qp = NULL; break; } + + if (cmd_finished) { + break; + } continue; } @@ -304,7 +315,8 @@ run_remote_cmd(char *cmdline) /* dump_qp(qp); */ if (qp && qp->qp_type == QP_CMDEXIT) { - break; + cmd_finished = 1; + /* break; */ } nset--; } |