Diff for /libaitrpc/src/cli.c between versions 1.25 and 1.25.2.3

version 1.25, 2015/05/18 15:09:59 version 1.25.2.3, 2015/06/28 22:11:30
Line 223  rpc_cli_openClient(u_char InstID, int netBuf, const ch Line 223  rpc_cli_openClient(u_char InstID, int netBuf, const ch
                         LOGERR;                          LOGERR;
                         goto err;                          goto err;
                 }                  }
           if (cli->cli_id == SOCK_DGRAM) {
                   sockaddr_t sa2;
   
                   if (!e_gethostbyname(csHost, 0, &sa2))
                           goto err;
                   if (bind(cli->cli_sock, &sa2.sa, sa2.sa.sa_len) == -1) {
                           LOGERR;
                           goto err;
                   }
           }
   
         fcntl(cli->cli_sock, F_SETFL, fcntl(cli->cli_sock, F_GETFL) | O_NONBLOCK);          fcntl(cli->cli_sock, F_SETFL, fcntl(cli->cli_sock, F_GETFL) | O_NONBLOCK);
         return cli;          return cli;
 err:  err:
Line 251  rpc_cli_reconnectClient(rpc_cli_t * __restrict cli) Line 261  rpc_cli_reconnectClient(rpc_cli_t * __restrict cli)
         else          else
                 netBuf = AIT_LEN(&cli->cli_buf);                  netBuf = AIT_LEN(&cli->cli_buf);
   
           if (cli->cli_id == SOCK_STREAM)
                   shutdown(cli->cli_sock, SHUT_RDWR);
           if (cli->cli_id == SOCK_DGRAM && cli->cli_sa.sa.sa_family == AF_LOCAL) {
                   sockaddr_t sa2 = E_SOCKADDR_INIT;
                   socklen_t salen;
   
                   sa2.sa.sa_len = salen = sizeof sa2;
                   if (!getsockname(cli->cli_sock, &sa2.sa, &salen))
                           unlink(sa2.sun.sun_path);
           }
         close(cli->cli_sock);          close(cli->cli_sock);
   
         srandom(time(NULL) ^ getpid());          srandom(time(NULL) ^ getpid());
Line 297  rpc_cli_closeClient(rpc_cli_t ** __restrict cli) Line 317  rpc_cli_closeClient(rpc_cli_t ** __restrict cli)
   
         if ((*cli)->cli_id == SOCK_STREAM)          if ((*cli)->cli_id == SOCK_STREAM)
                 shutdown((*cli)->cli_sock, SHUT_RDWR);                  shutdown((*cli)->cli_sock, SHUT_RDWR);
           if ((*cli)->cli_id == SOCK_DGRAM && (*cli)->cli_sa.sa.sa_family == AF_LOCAL) {
                   sockaddr_t sa2 = E_SOCKADDR_INIT;
                   socklen_t salen;
   
                   sa2.sa.sa_len = salen = sizeof sa2;
                   if (!getsockname((*cli)->cli_sock, &sa2.sa, &salen))
                           unlink(sa2.sun.sun_path);
           }
         close((*cli)->cli_sock);          close((*cli)->cli_sock);
   
         AIT_FREE_VAL(&(*cli)->cli_buf);          AIT_FREE_VAL(&(*cli)->cli_buf);
Line 359  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res Line 387  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
   
                 if (ret > 0) {                  if (ret > 0) {
                         rpc = (struct tagRPCCall*) AIT_GET_BUF(pkt);                          rpc = (struct tagRPCCall*) AIT_GET_BUF(pkt);
                           if (ret < ntohl(rpc->call_len))
                                   continue;
   
                         /* check for loop request */                          /* check for loop request */
                         if (!(rpc->call_io & RPC_ACK))                          if (!(rpc->call_io & RPC_ACK))

Removed from v.1.25  
changed lines
  Added in v.1.25.2.3


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