version 1.26.4.2, 2016/08/02 10:26:58
|
version 1.26.4.3, 2016/08/02 12:00:39
|
Line 161 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 161 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
int n = 1; |
int n = 1; |
rpc_cli_t *cli = NULL; |
rpc_cli_t *cli = NULL; |
sockaddr_t sa = E_SOCKADDR_INIT; |
sockaddr_t sa = E_SOCKADDR_INIT; |
|
socklen_t salen; |
|
|
if (proto < 0 || proto > SOCK_RAW) { |
if (proto < 0 || proto > SOCK_RAW) { |
rpc_SetErr(EINVAL, "Invalid parameters can`t open RPC client"); |
rpc_SetErr(EINVAL, "Invalid parameters can`t open RPC client"); |
Line 171 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 172 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
|
|
if (!Port && proto < SOCK_RAW) |
if (!Port && proto < SOCK_RAW) |
Port = RPC_DEFPORT; |
Port = RPC_DEFPORT; |
if (!e_gethostbyname(csHost, Port, &sa)) | if (!(salen = e_gethostbyname(csHost, Port, &sa))) |
return NULL; |
return NULL; |
if (!proto) |
if (!proto) |
proto = SOCK_STREAM; |
proto = SOCK_STREAM; |
Line 221 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 222 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
} |
} |
if (cli->cli_id == SOCK_STREAM) { |
if (cli->cli_id == SOCK_STREAM) { |
setsockopt(cli->cli_sock, IPPROTO_TCP, TCP_NODELAY, &n, sizeof n); |
setsockopt(cli->cli_sock, IPPROTO_TCP, TCP_NODELAY, &n, sizeof n); |
if (connect(cli->cli_sock, &cli->cli_sa.sa, sizeof cli->cli_sa.sa) == -1) { | if (connect(cli->cli_sock, &cli->cli_sa.sa, salen) == -1) { |
LOGERR; |
LOGERR; |
goto err; |
goto err; |
} |
} |
Line 229 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 230 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
if (cli->cli_id == SOCK_DGRAM) { |
if (cli->cli_id == SOCK_DGRAM) { |
sockaddr_t sa2; |
sockaddr_t sa2; |
|
|
if (!e_gethostbyname(csHost, 0, &sa2)) | if (!(salen = e_gethostbyname(csHost, 0, &sa2))) |
goto err; |
goto err; |
if (bind(cli->cli_sock, &sa2.sa, sizeof sa2.sa) == -1) { | if (bind(cli->cli_sock, &sa2.sa, salen) == -1) { |
LOGERR; |
LOGERR; |
goto err; |
goto err; |
} |
} |
Line 298 rpc_cli_reconnectClient(rpc_cli_t * __restrict cli)
|
Line 299 rpc_cli_reconnectClient(rpc_cli_t * __restrict cli)
|
return -1; |
return -1; |
} |
} |
if (cli->cli_id == SOCK_STREAM) |
if (cli->cli_id == SOCK_STREAM) |
if (connect(cli->cli_sock, &cli->cli_sa.sa, sizeof cli->cli_sa.sa) == -1) { | if (connect(cli->cli_sock, &cli->cli_sa.sa, e_addrlen(&cli->cli_sa)) == -1) { |
LOGERR; |
LOGERR; |
close(cli->cli_sock); |
close(cli->cli_sock); |
return -1; |
return -1; |