Fix problem with mixing is_backend and terse_output
[fio.git] / server.c
index 9cbe555f5888c387629d5f4c0237515af6e2fe48..7c4804adc17195675eaad8a101488a9746ab2ecf 100644 (file)
--- a/server.c
+++ b/server.c
@@ -20,7 +20,7 @@
 #include "fio.h"
 #include "server.h"
 #include "crc/crc16.h"
-#include "ieee754.h"
+#include "lib/ieee754.h"
 
 #include "fio_version.h"
 
@@ -32,6 +32,7 @@ static int server_fd = -1;
 static char *fio_server_arg;
 static char *bind_sock;
 static struct sockaddr_in saddr_in;
+static int first_cmd_check;
 
 static const char *fio_server_ops[FIO_NET_CMD_NR] = {
        "",
@@ -48,6 +49,7 @@ static const char *fio_server_ops[FIO_NET_CMD_NR] = {
        "START",
        "STOP",
        "DISK_UTIL",
+       "RUN",
 };
 
 const char *fio_server_op(unsigned int op)
@@ -181,8 +183,12 @@ struct fio_net_cmd *fio_net_recv_cmd(int sk)
 
                if (first)
                        memcpy(cmdret, &cmd, sizeof(cmd));
-               else
-                       assert(cmdret->opcode == cmd.opcode);
+               else if (cmdret->opcode != cmd.opcode) {
+                       log_err("fio: fragment opcode mismatch (%d != %d)\n",
+                                       cmdret->opcode, cmd.opcode);
+                       ret = 1;
+                       break;
+               }
 
                if (!cmd.pdu_len)
                        break;
@@ -539,6 +545,8 @@ static int handle_connection(int sk, int block)
 
 void fio_server_idle_loop(void)
 {
+       if (!first_cmd_check)
+               fio_net_send_simple_cmd(server_fd, FIO_NET_CMD_RUN, 0, NULL);
        if (server_fd != -1)
                handle_connection(server_fd, 0);
 }