Diff for /libaitrpc/src/srv.c between versions 1.14.2.1 and 1.16.2.2

version 1.14.2.1, 2013/04/02 09:17:06 version 1.16.2.2, 2013/07/15 14:22:00
Line 67  static sched_task_func_t cbProto[SOCK_RAW + 1][4] = { Line 67  static sched_task_func_t cbProto[SOCK_RAW + 1][4] = {
 };  };
   
   
inline voidvoid
 rpc_freeCli(rpc_cli_t * __restrict c)  rpc_freeCli(rpc_cli_t * __restrict c)
 {  {
         rpc_srv_t *s = c->cli_parent;          rpc_srv_t *s = c->cli_parent;
Line 193  txPacket(sched_task_t *task) Line 193  txPacket(sched_task_t *task)
   
         rpc->call_len = htons(wlen);          rpc->call_len = htons(wlen);
   
   #if 0
         /* calculate CRC */          /* calculate CRC */
         rpc->call_crc ^= rpc->call_crc;          rpc->call_crc ^= rpc->call_crc;
         rpc->call_crc = htons(crcFletcher16((u_short*) buf, wlen / 2));          rpc->call_crc = htons(crcFletcher16((u_short*) buf, wlen / 2));
   #endif
   
         /* send reply */          /* send reply */
         ret = send(TASK_FD(task), buf, wlen, MSG_NOSIGNAL);          ret = send(TASK_FD(task), buf, wlen, MSG_NOSIGNAL);
Line 269  rxPacket(sched_task_t *task) Line 271  rxPacket(sched_task_t *task)
         rpc_cli_t *c = TASK_ARG(task);          rpc_cli_t *c = TASK_ARG(task);
         rpc_srv_t *s = c->cli_parent;          rpc_srv_t *s = c->cli_parent;
         int len, rlen, noreply;          int len, rlen, noreply;
        u_short crc, off = TASK_DATLEN(task);        u_short off = TASK_DATLEN(task);
 #if 0
         u_short crc;
 #endif
         u_char *buf = AIT_GET_BUF(&c->cli_buf);          u_char *buf = AIT_GET_BUF(&c->cli_buf);
         struct tagRPCCall *rpc;          struct tagRPCCall *rpc;
   
Line 308  rxPacket(sched_task_t *task) Line 313  rxPacket(sched_task_t *task)
                         break;                          break;
                 }                  }
   
   #if 0
                 /* check integrity of packet */                  /* check integrity of packet */
                 crc = ntohs(rpc->call_crc);                  crc = ntohs(rpc->call_crc);
                 rpc->call_crc ^= rpc->call_crc;                  rpc->call_crc ^= rpc->call_crc;
Line 318  rxPacket(sched_task_t *task) Line 324  rxPacket(sched_task_t *task)
                         /* try next packet remaining into buffer */                          /* try next packet remaining into buffer */
                         continue;                          continue;
                 }                  }
   #endif
   
                 noreply = RPC_CHK_NOREPLY(rpc);                  noreply = RPC_CHK_NOREPLY(rpc);
   
Line 522  end: Line 529  end:
   
 /* ------------------------------------------------------ */  /* ------------------------------------------------------ */
   
inline voidvoid
 rpc_freeBLOBCli(rpc_cli_t * __restrict c)  rpc_freeBLOBCli(rpc_cli_t * __restrict c)
 {  {
         rpc_srv_t *s = c->cli_parent;          rpc_srv_t *s = c->cli_parent;
Line 552  closeBLOBClient(sched_task_t *task) Line 559  closeBLOBClient(sched_task_t *task)
 }  }
   
 static void *  static void *
   toutBLOB(sched_task_t *task)
   {
           rpc_cli_t *c = TASK_ARG(task);
   
           rpc_srv_unregisterBLOB((rpc_srv_t*) c->cli_parent, (uint32_t) TASK_DATA(task));
   
           return NULL;
   }
   
   static void *
 txBLOB(sched_task_t *task)  txBLOB(sched_task_t *task)
 {  {
         rpc_cli_t *c = TASK_ARG(task);          rpc_cli_t *c = TASK_ARG(task);
Line 576  rxBLOB(sched_task_t *task) Line 593  rxBLOB(sched_task_t *task)
         rpc_blob_t *b;          rpc_blob_t *b;
         struct tagBLOBHdr blob;          struct tagBLOBHdr blob;
         int rlen;          int rlen;
        u_short crc;        struct timespec ts = { RPC_BLOB_TIMEOUT, 0 };
   
         memset(&blob, 0, sizeof blob);          memset(&blob, 0, sizeof blob);
         rlen = recv(TASK_FD(task), &blob, sizeof blob, 0);          rlen = recv(TASK_FD(task), &blob, sizeof blob, 0);
Line 595  rxBLOB(sched_task_t *task) Line 612  rxBLOB(sched_task_t *task)
         }          }
   
         /* check RPC packet session info */          /* check RPC packet session info */
        if ((crc = rpc_chkPktSession(&blob.hdr_session, &s->srv_session))) {        if (rpc_chkPktSession(&blob.hdr_session, &s->srv_session)) {
                 rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session");                  rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session");
                 blob.hdr_cmd = error;                  blob.hdr_cmd = error;
                 goto end;                  goto end;
Line 626  rxBLOB(sched_task_t *task) Line 643  rxBLOB(sched_task_t *task)
                                 /* set new BLOB variable for reply :) */                                  /* set new BLOB variable for reply :) */
                                 blob.hdr_var = htonl(b->blob_var);                                  blob.hdr_var = htonl(b->blob_var);
   
                                   /* set live BLOB timeout */
                                   ts.tv_sec = blob.hdr_ret ? blob.hdr_ret : RPC_BLOB_TIMEOUT;
   
                                 /* receive BLOB from client */                                  /* receive BLOB from client */
                                 blob.hdr_ret = htonl(rpc_srv_recvBLOB(c, b));                                  blob.hdr_ret = htonl(rpc_srv_recvBLOB(c, b));
                                 rpc_srv_blobUnmap(b);                                  rpc_srv_blobUnmap(b);
   
                                   schedTimer(TASK_ROOT(task), toutBLOB, TASK_ARG(task), ts, 
                                                   (void*) (intptr_t) ntohl(blob.hdr_var), ntohl(blob.hdr_len));
                         } else {                          } else {
                                 blob.hdr_cmd = error;                                  blob.hdr_cmd = error;
                                 blob.hdr_ret = RPC_ERROR(-1);                                  blob.hdr_ret = RPC_ERROR(-1);
Line 639  rxBLOB(sched_task_t *task) Line 662  rxBLOB(sched_task_t *task)
                                 blob.hdr_cmd = error;                                  blob.hdr_cmd = error;
                                 blob.hdr_ret = RPC_ERROR(-1);                                  blob.hdr_ret = RPC_ERROR(-1);
                         }                          }
   
                           schedCancelby(TASK_ROOT(task), taskTIMER, CRITERIA_DATA, 
                                           (void*) (intptr_t) ntohl(blob.hdr_var), NULL);
                         break;                          break;
                 default:                  default:
                         rpc_SetErr(EPROCUNAVAIL, "Unsupported BLOB command %d", blob.hdr_cmd);                          rpc_SetErr(EPROCUNAVAIL, "Unsupported BLOB command %d", blob.hdr_cmd);
Line 820  rpc_srv_initBLOBServer(rpc_srv_t * __restrict srv, u_s Line 846  rpc_srv_initBLOBServer(rpc_srv_t * __restrict srv, u_s
  * @srv = RPC Server instance   * @srv = RPC Server instance
  * return: none   * return: none
  */   */
inline voidvoid
 rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv)  rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv)
 {  {
         if (!srv)          if (!srv)
Line 1023  err: /* error condition */ Line 1049  err: /* error condition */
  * @psrv = RPC Server instance   * @psrv = RPC Server instance
  * return: none   * return: none
  */   */
inline voidvoid
 rpc_srv_endServer(rpc_srv_t ** __restrict psrv)  rpc_srv_endServer(rpc_srv_t ** __restrict psrv)
 {  {
         if (!psrv || !*psrv)          if (!psrv || !*psrv)

Removed from v.1.14.2.1  
changed lines
  Added in v.1.16.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>