Code

Moved sdb_proto_send/sdb_proto_select to sdb_write/sdb_select.
[sysdb.git] / src / client / sock.c
index 533e9e31b62c16457f36ae1e844a450251c26c51..d4596cd7a858cda76e1144492c5e2cf71c11291b 100644 (file)
@@ -33,6 +33,7 @@
 #include "utils/error.h"
 #include "utils/strbuf.h"
 #include "utils/proto.h"
+#include "utils/os.h"
 
 #include <arpa/inet.h>
 
@@ -248,10 +249,14 @@ ssize_t
 sdb_client_send(sdb_client_t *client,
                uint32_t cmd, uint32_t msg_len, const char *msg)
 {
+       char buf[2 * sizeof(uint32_t) + msg_len];
+
        if ((! client) || (! client->fd))
                return -1;
+       if (sdb_proto_marshal(buf, sizeof(buf), cmd, msg_len, msg) < 0)
+               return -1;
 
-       return sdb_proto_send_msg(client->fd, cmd, msg_len, msg);
+       return sdb_write(client->fd, sizeof(buf), buf);
 } /* sdb_client_send */
 
 ssize_t
@@ -277,7 +282,7 @@ sdb_client_recv(sdb_client_t *client,
        while (42) {
                ssize_t status;
 
-               if (sdb_proto_select(client->fd, SDB_PROTO_SELECTIN))
+               if (sdb_select(client->fd, SDB_SELECTIN))
                        return -1;
 
                errno = 0;