--- libaitrpc/src/srv.c 2010/06/23 15:07:15 1.1.1.1.2.5 +++ libaitrpc/src/srv.c 2010/06/23 16:23:31 1.1.1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.1.1.1.2.5 2010/06/23 15:07:15 misho Exp $ +* $Id: srv.c,v 1.1.1.1.2.6 2010/06/23 16:23:31 misho Exp $ * *************************************************************************/ #include "global.h" @@ -185,7 +185,7 @@ rpc_srv_dispatchVars(void *arg) rpc_blob_t *b; int cx, ret; fd_set fds; - u_char buf[BLOBSIZ]; + u_char buf[sizeof(struct tagBLOBHdr)]; struct tagBLOBHdr *blob; if (!arg) { @@ -204,8 +204,8 @@ rpc_srv_dispatchVars(void *arg) if (ret == -1) { ret = -2; } - memset(buf, 0, BLOBSIZ); - if ((ret = recv(c->cli_sock, buf, BLOBSIZ, 0)) == -1) { + memset(buf, 0, sizeof buf); + if ((ret = recv(c->cli_sock, buf, sizeof buf, 0)) == -1) { LOGERR; ret = -3; break; @@ -235,19 +235,29 @@ rpc_srv_dispatchVars(void *arg) } switch (blob->hdr_cmd) { case get: - ret = rpc_srv_sendBLOB(c, b); + if (rpc_srv_blobMap(s, b) != -1) { + ret = rpc_srv_sendBLOB(c, b); + rpc_srv_blobUnmap(b); + } else + ret = -7; break; case set: ret = rpc_srv_recvBLOB(c, b); + if (ret == -1) + ret = -7; break; case unset: - ret = rpc_srv_freeBLOB(b); + ret = rpc_srv_deleteBLOB(c, b); + if (ret == -1) + ret = -7; break; default: rpc_SetErr(EINVAL, "Error:: unsupported BLOB command (%d)...\n", blob->hdr_cmd); ret -7; } + + // Replay to client! } while (ret > -1); shutdown(c->cli_sock, SHUT_RDWR);