Code

connection: Use sdb_proto_unmarshal_header.
authorSebastian Harl <sh@tokkee.org>
Mon, 15 Dec 2014 09:46:25 +0000 (10:46 +0100)
committerSebastian Harl <sh@tokkee.org>
Mon, 15 Dec 2014 09:46:25 +0000 (10:46 +0100)
src/frontend/connection.c

index 58a2cb4d3e3d06d510927b57b414f37bc3af425c..09f906c045183fc9ab4e6d59b538580d7eed5e1f 100644 (file)
@@ -358,9 +358,8 @@ command_init(sdb_conn_t *conn)
        /* reset */
        sdb_strbuf_clear(conn->errbuf);
 
-       conn->cmd = sdb_proto_get_int(conn->buf, 0);
-       conn->cmd_len = sdb_proto_get_int(conn->buf, sizeof(uint32_t));
-
+       if (sdb_proto_unmarshal_header(conn->buf, &conn->cmd, &conn->cmd_len))
+               return -1;
        sdb_strbuf_skip(conn->buf, 0, 2 * sizeof(uint32_t));
 
        if ((! conn->ready) && (conn->cmd != SDB_CONNECTION_STARTUP))