server: quit client when job run is complete
authorJens Axboe <axboe@kernel.dk>
Sat, 1 Oct 2011 14:31:30 +0000 (08:31 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 1 Oct 2011 14:31:30 +0000 (08:31 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c
server.c

index dfc172eac220ecda8571340e78d15fd5f7d14bf2..b47624b53393f9977e1d869f517b7bf52a0b9270 100644 (file)
--- a/client.c
+++ b/client.c
@@ -128,6 +128,10 @@ int fio_handle_clients(void)
                        free(cmd);
                        continue;
                }
+               if (cmd->opcode == FIO_NET_CMD_QUIT) {
+                       free(cmd);
+                       break;
+               }
                if (cmd->opcode != FIO_NET_CMD_TEXT) {
                        printf("non text: %d\n", cmd->opcode);
                        free(cmd);
index fe93ffbebda4840e46683187bdd4efc567e048a4..e7b774171ccaa7c99893e6a9656c93f98f738926 100644 (file)
--- a/server.c
+++ b/server.c
@@ -189,6 +189,11 @@ static int nak_command(int sk, struct fio_net_cmd *cmd)
 }
 #endif
 
+static int send_quit_command(void)
+{
+       return send_simple_command(server_fd, FIO_NET_CMD_QUIT, 0);
+}
+
 static int handle_cur_job(struct fio_net_cmd *cmd, int done)
 {
        unsigned int left = job_max_len - job_cur_len;
@@ -205,6 +210,7 @@ static int handle_cur_job(struct fio_net_cmd *cmd, int done)
        if (done) {
                parse_jobs_ini(job_buf, 1, 0);
                ret = exec_run();
+               send_quit_command();
                reset_fio_state();
                free(job_buf);
                job_buf = NULL;