Diff for /libaitrpc/src/cli.c between versions 1.6.2.2 and 1.7.2.1

version 1.6.2.2, 2012/03/14 13:29:11 version 1.7.2.1, 2012/03/28 11:07:36
Line 288  rpc_cli_closeClient(rpc_cli_t * __restrict cli) Line 288  rpc_cli_closeClient(rpc_cli_t * __restrict cli)
  * rpc_cli_execCall() - Execute RPC call   * rpc_cli_execCall() - Execute RPC call
  *   *
  * @cli = RPC Client session   * @cli = RPC Client session
    * @noreply = We not want RPC reply
  * @csModule = Module name, if NULL self binary   * @csModule = Module name, if NULL self binary
  * @csFunc = Function name for execute   * @csFunc = Function name for execute
  * @in_vars = IN RPC call array of rpc values   * @in_vars = IN RPC call array of rpc values
Line 295  rpc_cli_closeClient(rpc_cli_t * __restrict cli) Line 296  rpc_cli_closeClient(rpc_cli_t * __restrict cli)
  * return: -1 error or != -1 ok result   * return: -1 error or != -1 ok result
  */   */
 int  int
rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, const char *csFunc, rpc_cli_execCall(rpc_cli_t *cli, int noreply, const char *csModule, const char *csFunc, 
                 array_t * __restrict in_vars, array_t ** __restrict out_vars)                  array_t * __restrict in_vars, array_t ** __restrict out_vars)
 {  {
         fd_set fds;          fd_set fds;
Line 304  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, Line 305  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
         struct tagRPCCall *rpc;          struct tagRPCCall *rpc;
         int ret = 0, wlen = sizeof(struct tagRPCCall);          int ret = 0, wlen = sizeof(struct tagRPCCall);
         struct timeval tv = { DEF_RPC_TIMEOUT, 0 };          struct timeval tv = { DEF_RPC_TIMEOUT, 0 };
        uint16_t tag, crc;        uint16_t tag;
         uint32_t hash;          uint32_t hash;
   
         if (!cli || !csFunc) {          if (!cli || !csFunc) {
Line 338  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, Line 339  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
         rpc->call_tag = tag;          rpc->call_tag = tag;
         rpc->call_hash = hash;          rpc->call_hash = hash;
   
           /* set reply */
           rpc->call_req.flags = noreply ? RPC_NOREPLY : RPC_REPLY;
   
         if (io_arraySize(in_vars)) {          if (io_arraySize(in_vars)) {
                 /* marshaling variables */                  /* marshaling variables */
                 ret = io_vars2buffer(buf + wlen, cli->cli_netbuf - wlen, in_vars);                  ret = io_vars2buffer(buf + wlen, cli->cli_netbuf - wlen, in_vars);
Line 351  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, Line 355  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
   
         /* 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 + 1) & ~1) / 2));        rpc->call_crc = htons(crcFletcher16((u_short*) buf, io_align(wlen, 1) / 2));
   
         if ((ret = send(cli->cli_sock, buf, wlen, 0)) == -1) {          if ((ret = send(cli->cli_sock, buf, wlen, 0)) == -1) {
                 LOGERR;                  LOGERR;
Line 362  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, Line 366  rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
                                 "really sended %d bytes", wlen, ret);                                  "really sended %d bytes", wlen, ret);
                 free(buf);                  free(buf);
                 return -1;                  return -1;
           }
   
           if (noreply) {
                   /* we not want reply */
                   free(buf);
                   return 0;
         }          }
   
         /* reply from RPC server */          /* reply from RPC server */

Removed from v.1.6.2.2  
changed lines
  Added in v.1.7.2.1


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