--- libaitrpc/src/srv.c 2010/07/08 07:17:18 1.1.1.1.2.17 +++ libaitrpc/src/srv.c 2010/07/08 07:32:53 1.1.1.1.2.18 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.1.1.1.2.17 2010/07/08 07:17:18 misho Exp $ +* $Id: srv.c,v 1.1.1.1.2.18 2010/07/08 07:32:53 misho Exp $ * *************************************************************************/ #include "global.h" @@ -179,7 +179,7 @@ rpc_srv_dispatchVars(void *arg) rpc_cli_t *c = arg; rpc_srv_t *s; rpc_blob_t *b; - int cx, ret; + int ret; fd_set fds; u_char buf[sizeof(struct tagBLOBHdr)]; struct tagBLOBHdr *blob; @@ -190,7 +190,6 @@ rpc_srv_dispatchVars(void *arg) } else s = c->cli_parent; - cx = -1; do { // check for disable service at this moment? if (s->srv_blob.state == disable) { @@ -203,8 +202,8 @@ rpc_srv_dispatchVars(void *arg) ret = select(c->cli_sock + 1, &fds, NULL, NULL, NULL); if (ret == -1) { ret = -2; - } else - cx++; + } + memset(buf, 0, sizeof buf); if ((ret = recv(c->cli_sock, buf, sizeof buf, 0)) == -1) { LOGERR; @@ -222,9 +221,8 @@ rpc_srv_dispatchVars(void *arg) } else blob = (struct tagBLOBHdr*) buf; // check BLOB packet session info - if (memcmp(&blob->hdr_session, &s->srv_session, sizeof blob->hdr_session) || - blob->hdr_seq != cx) { - rpc_SetErr(EINVAL, "Error:: get invalid BLOB session in seq=%d...\n", blob->hdr_seq); + if (memcmp(&blob->hdr_session, &s->srv_session, sizeof blob->hdr_session)) { + rpc_SetErr(EINVAL, "Error:: get invalid BLOB session ...\n"); ret = -5; goto makeReply; } @@ -237,7 +235,6 @@ rpc_srv_dispatchVars(void *arg) ret = -6; break; } - printf("++++++ %p\n", b); if (rpc_srv_blobMap(s, b) != -1) { ret = rpc_srv_sendBLOB(c, b); @@ -265,12 +262,11 @@ rpc_srv_dispatchVars(void *arg) blob->hdr_cmd); ret = -7; } - cx++; makeReply: // Replay to client! blob->hdr_cmd = ret < 0 ? error : ok; - blob->hdr_seq = ret; + blob->hdr_ret = ret; if ((ret = send(c->cli_sock, buf, sizeof buf, 0)) == -1) { LOGERR; ret = -8; @@ -282,8 +278,6 @@ makeReply: ret = -9; break; } - cx = -1; - } while (ret > -1); shutdown(c->cli_sock, SHUT_RDWR);