+ cmd = fio_net_recv_cmd(client->fd);
+ if (!cmd)
+ return 0;
+
+ dprint(FD_NET, "client: got cmd op %s from %s\n",
+ fio_server_op(cmd->opcode), client->hostname);
+
+ switch (cmd->opcode) {
+ case FIO_NET_CMD_QUIT:
+ remove_client(client);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_TEXT: {
+ const char *buf = (const char *) cmd->payload;
+ const char *name;
+ int fio_unused ret;
+
+ name = client->name ? client->name : client->hostname;
+
+ if (!client->skip_newline)
+ fprintf(f_out, "<%s> ", name);
+ ret = fwrite(buf, cmd->pdu_len, 1, f_out);
+ fflush(f_out);
+ client->skip_newline = strchr(buf, '\n') == NULL;
+ free(cmd);
+ break;
+ }
+ case FIO_NET_CMD_DU:
+ handle_du(client, cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_TS:
+ handle_ts(client, cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_GS:
+ handle_gs(cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_ETA:
+ remove_reply_cmd(client, cmd);
+ handle_eta(client, cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_PROBE:
+ remove_reply_cmd(client, cmd);
+ handle_probe(client, cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_RUN:
+ client->state = Client_running;
+ free(cmd);
+ break;
+ case FIO_NET_CMD_START:
+ handle_start(client, cmd);
+ free(cmd);
+ break;
+ case FIO_NET_CMD_STOP:
+ handle_stop(client, cmd);
+ free(cmd);
+ break;
+ default:
+ log_err("fio: unknown client op: %s\n", fio_server_op(cmd->opcode));
+ free(cmd);
+ break;
+ }