Diff for /libaitrpc/src/srv.c between versions 1.30 and 1.30.2.6

version 1.30, 2020/06/25 19:11:00 version 1.30.2.6, 2024/02/26 13:30:59
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004 - 2016Copyright 2004 - 2024
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 291  execCall(sched_task_t *task) Line 291  execCall(sched_task_t *task)
                         if (TASK_VAL(task)) {                          if (TASK_VAL(task)) {
                                 /* without reply */                                  /* without reply */
                                 ait_freeVars(&c->cli_vars);                                  ait_freeVars(&c->cli_vars);
                        } else {                        } else if (rpc->call_io & RPC_REQ) {
                                 /* reply */                                  /* reply */
                                 rpc->call_argc = (u_char) array_Size(RPC_RETVARS(c));                                  rpc->call_argc = (u_char) array_Size(RPC_RETVARS(c));
                         }                          }
Line 387  rxPacket(sched_task_t *task) Line 387  rxPacket(sched_task_t *task)
         schedEvent(TASK_ROOT(task), execCall, TASK_ARG(task), (int) noreply, rpc, len);          schedEvent(TASK_ROOT(task), execCall, TASK_ARG(task), (int) noreply, rpc, len);
 err:  err:
         /* send RPC reply */          /* send RPC reply */
        if (!noreply)        if (!noreply && (rpc->call_io & RPC_REQ))
                 schedWrite(TASK_ROOT(task), cbProto[s->srv_proto][CB_TXPACKET],                   schedWrite(TASK_ROOT(task), cbProto[s->srv_proto][CB_TXPACKET], 
                                 TASK_ARG(task), TASK_FD(task), rpc, len);                                  TASK_ARG(task), TASK_FD(task), rpc, len);
   
Line 544  rxUDPPacket(sched_task_t *task) Line 544  rxUDPPacket(sched_task_t *task)
         /* 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;
        if (crc != crcFletcher16((u_short*) rpc, len / 2))        if (crc != crcFletcher16((u_short*) AIT_GET_BUF(&b), len / 2))
                 goto end;                  goto end;
   
         /* check RPC packet session info */          /* check RPC packet session info */
Line 575  rxUDPPacket(sched_task_t *task) Line 575  rxUDPPacket(sched_task_t *task)
         schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);          schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);
   
         /* send RPC reply */          /* send RPC reply */
        if (!noreply)        if (!noreply && (rpc->call_io & RPC_REQ))
                 schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET],                   schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], 
                                 c, TASK_FD(task), rpc, len);                                  c, TASK_FD(task), rpc, len);
 end:  end:
Line 708  rxRAWPacket(sched_task_t *task) Line 708  rxRAWPacket(sched_task_t *task)
         /* 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;
        if (crc != crcFletcher16((u_short*) rpc, len / 2))        if (crc != crcFletcher16((u_short*) AIT_GET_BUF(&b), len / 2))
                 goto end;                  goto end;
   
         /* check RPC packet session info */          /* check RPC packet session info */
Line 739  rxRAWPacket(sched_task_t *task) Line 739  rxRAWPacket(sched_task_t *task)
         schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);          schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);
   
         /* send RPC reply */          /* send RPC reply */
        if (!noreply)        if (!noreply && (rpc->call_io & RPC_REQ))
                 schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET],                   schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], 
                                 c, TASK_FD(task), rpc, len);                                  c, TASK_FD(task), rpc, len);
 end:  end:
Line 909  rxBPFPacket(sched_task_t *task) Line 909  rxBPFPacket(sched_task_t *task)
         schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);          schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);
   
         /* send RPC reply */          /* send RPC reply */
        if (!noreply)        if (!noreply && (rpc->call_io & RPC_REQ))
                 schedEvent(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET],                   schedEvent(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], 
                                 c, TASK_FD(task), rpc, len);                                  c, TASK_FD(task), rpc, len);
 end:  end:
Line 1039  rxEXTPacket(sched_task_t *task) Line 1039  rxEXTPacket(sched_task_t *task)
         schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);          schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len);
   
         /* send RPC reply */          /* send RPC reply */
        if (!noreply)        if (!noreply && (rpc->call_io & RPC_REQ))
                 schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET],                   schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], 
                                 c, TASK_FD(task), rpc, len);                                  c, TASK_FD(task), rpc, len);
 end:  end:
Line 1558  rpc_srv_initServer(u_char InstID, int concurentClients Line 1558  rpc_srv_initServer(u_char InstID, int concurentClients
                 pthread_mutex_destroy(&srv->srv_funcs.mtx);                  pthread_mutex_destroy(&srv->srv_funcs.mtx);
                 e_free(srv);                  e_free(srv);
                 return NULL;                  return NULL;
        }        } else
                 schedSignalDispatch(srv->srv_root, 42);
   
         /* init pool for clients */          /* init pool for clients */
         srv->srv_clients = array_Init(concurentClients);          srv->srv_clients = array_Init(concurentClients);
Line 1680  rpc_srv_loopServer(rpc_srv_t * __restrict srv) Line 1681  rpc_srv_loopServer(rpc_srv_t * __restrict srv)
         schedPolling(srv->srv_root, &ts, NULL);          schedPolling(srv->srv_root, &ts, NULL);
         /* main rpc loop */          /* main rpc loop */
         schedRun(srv->srv_root, &srv->srv_kill);          schedRun(srv->srv_root, &srv->srv_kill);
           schedSignalDispatch(srv->srv_root, 0);
   
         /* close all clients connections & server socket */          /* close all clients connections & server socket */
         for (i = 0; i < array_Size(srv->srv_clients); i++) {          for (i = 0; i < array_Size(srv->srv_clients); i++) {
Line 1818  rpc_srv_initServer2(u_char InstID, int concurentClient Line 1820  rpc_srv_initServer2(u_char InstID, int concurentClient
                 pthread_mutex_destroy(&srv->srv_funcs.mtx);                  pthread_mutex_destroy(&srv->srv_funcs.mtx);
                 e_free(srv);                  e_free(srv);
                 return NULL;                  return NULL;
        }        } else
                 schedSignalDispatch(srv->srv_root, 42);
   
         /* init pool for clients */          /* init pool for clients */
         srv->srv_clients = array_Init(concurentClients);          srv->srv_clients = array_Init(concurentClients);
Line 1936  rpc_srv_initServerExt(u_char InstID, int netBuf, int f Line 1939  rpc_srv_initServerExt(u_char InstID, int netBuf, int f
                 pthread_mutex_destroy(&srv->srv_funcs.mtx);                  pthread_mutex_destroy(&srv->srv_funcs.mtx);
                 e_free(srv);                  e_free(srv);
                 return NULL;                  return NULL;
        }        } else
                 schedSignalDispatch(srv->srv_root, 42);
   
         /* init pool for clients */          /* init pool for clients */
         srv->srv_clients = array_Init(1);          srv->srv_clients = array_Init(1);

Removed from v.1.30  
changed lines
  Added in v.1.30.2.6


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