Diff for /libaitrpc/src/srv.c between versions 1.30.2.12 and 1.33

version 1.30.2.12, 2024/03/20 17:06:11 version 1.33, 2025/03/31 12:21:07
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 - 2024Copyright 2004 - 2025
         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 543  rxUDPPacket(sched_task_t *task) Line 543  rxUDPPacket(sched_task_t *task)
 #endif  #endif
         rlen = recvfrom(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b), 0, &sa.sa, &salen);          rlen = recvfrom(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b), 0, &sa.sa, &salen);
         rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);          rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);
        if (rlen < sizeof(struct tagRPCCall))        if (!rpc || rlen < sizeof(struct tagRPCCall))
                 goto end;                  goto end;
         else          else
                 len = ntohl(rpc->call_len);                  len = ntohl(rpc->call_len);
Line 687  rxRAWPacket(sched_task_t *task) Line 687  rxRAWPacket(sched_task_t *task)
         if (sa.sa.sa_family == AF_INET) {          if (sa.sa.sa_family == AF_INET) {
                 struct ip *h;                  struct ip *h;
                 h = (struct ip*) AIT_GET_BUF(&b);                  h = (struct ip*) AIT_GET_BUF(&b);
                if (rlen < ntohs(h->ip_len) || h->ip_p != IPPROTO_ERPC)                if (!h || rlen < ntohs(h->ip_len) || h->ip_p != IPPROTO_ERPC)
                         goto end;                          goto end;
                 else {                  else {
                         rlen -= sizeof(struct ip);                          rlen -= sizeof(struct ip);
Line 697  rxRAWPacket(sched_task_t *task) Line 697  rxRAWPacket(sched_task_t *task)
 #ifdef IPV6_REMOVE_HEADER  #ifdef IPV6_REMOVE_HEADER
                 struct ip6_hdr *h;                  struct ip6_hdr *h;
                 h = (struct ip6_hdr*) AIT_GET_BUF(&b);                  h = (struct ip6_hdr*) AIT_GET_BUF(&b);
                if (rlen < ntohs(h->ip6_plen) || h->ip6_nxt != IPPROTO_ERPC)                if (!h || rlen < ntohs(h->ip6_plen) || h->ip6_nxt != IPPROTO_ERPC)
                         goto end;                          goto end;
                 else {                  else {
                         rlen -= sizeof(struct ip6_hdr);                          rlen -= sizeof(struct ip6_hdr);
Line 707  rxRAWPacket(sched_task_t *task) Line 707  rxRAWPacket(sched_task_t *task)
                 rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);                  rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);
 #endif  #endif
         }          }
        if (rlen < sizeof(struct tagRPCCall))        if (!rpc || rlen < sizeof(struct tagRPCCall))
                 goto end;                  goto end;
         else          else
                 len = ntohl(rpc->call_len);                  len = ntohl(rpc->call_len);
Line 1014  rxEXTPacket(sched_task_t *task) Line 1014  rxEXTPacket(sched_task_t *task)
         AIT_SET_BUF(&b, NULL, srv->srv_netbuf);          AIT_SET_BUF(&b, NULL, srv->srv_netbuf);
         rlen = read(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b));          rlen = read(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b));
         rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);          rpc = (struct tagRPCCall*) AIT_GET_BUF(&b);
        if (rlen < sizeof(struct tagRPCCall))        if (!rpc || rlen < sizeof(struct tagRPCCall))
                 goto end;                  goto end;
         else          else
                 len = ntohl(rpc->call_len);                  len = ntohl(rpc->call_len);
Line 1562  rpc_srv_initServer(u_char InstID, int concurentClients Line 1562  rpc_srv_initServer(u_char InstID, int concurentClients
         /* init functions */          /* init functions */
         pthread_mutex_init(&srv->srv_funcs.mtx, NULL);          pthread_mutex_init(&srv->srv_funcs.mtx, NULL);
         SLIST_INIT(&srv->srv_funcs);          SLIST_INIT(&srv->srv_funcs);
        AVL_INIT(&srv->srv_funcs);        RB_INIT(&srv->srv_funcs);
   
         /* init scheduler */          /* init scheduler */
         srv->srv_root = schedBegin();          srv->srv_root = schedBegin();
Line 1722  rpc_srv_loopServer(rpc_srv_t * __restrict srv) Line 1722  rpc_srv_loopServer(rpc_srv_t * __restrict srv)
                 AIT_FREE_VAL(&f->func_name);                  AIT_FREE_VAL(&f->func_name);
                 e_free(f);                  e_free(f);
         }          }
        srv->srv_funcs.avlh_root = NULL;        srv->srv_funcs.rbh_root = NULL;
         RPC_FUNCS_UNLOCK(&srv->srv_funcs);          RPC_FUNCS_UNLOCK(&srv->srv_funcs);
   
         return 0;          return 0;
Line 1822  rpc_srv_initServer2(u_char InstID, int concurentClient Line 1822  rpc_srv_initServer2(u_char InstID, int concurentClient
         /* init functions */          /* init functions */
         pthread_mutex_init(&srv->srv_funcs.mtx, NULL);          pthread_mutex_init(&srv->srv_funcs.mtx, NULL);
         SLIST_INIT(&srv->srv_funcs);          SLIST_INIT(&srv->srv_funcs);
        AVL_INIT(&srv->srv_funcs);        RB_INIT(&srv->srv_funcs);
   
         /* init scheduler */          /* init scheduler */
         srv->srv_root = schedBegin();          srv->srv_root = schedBegin();
Line 1940  rpc_srv_initServerExt(u_char InstID, int netBuf, int f Line 1940  rpc_srv_initServerExt(u_char InstID, int netBuf, int f
         /* init functions */          /* init functions */
         pthread_mutex_init(&srv->srv_funcs.mtx, NULL);          pthread_mutex_init(&srv->srv_funcs.mtx, NULL);
         SLIST_INIT(&srv->srv_funcs);          SLIST_INIT(&srv->srv_funcs);
        AVL_INIT(&srv->srv_funcs);        RB_INIT(&srv->srv_funcs);
   
         /* init scheduler */          /* init scheduler */
         srv->srv_root = schedBegin();          srv->srv_root = schedBegin();

Removed from v.1.30.2.12  
changed lines
  Added in v.1.33


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