version 1.17.2.3, 2013/08/23 13:38:05
|
version 1.20, 2013/11/15 09:55:53
|
Line 295 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
Line 295 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
if (!pkt) { |
if (!pkt) { |
rpc_SetErr(EINVAL, "Invalid argument(s)!"); |
rpc_SetErr(EINVAL, "Invalid argument(s)!"); |
return -1; |
return -1; |
} else | } else { |
buf = AIT_GET_BUF(pkt); |
buf = AIT_GET_BUF(pkt); |
|
rpc = (struct tagRPCCall*) buf; |
|
} |
|
|
/* reply from RPC server */ |
/* reply from RPC server */ |
do { |
do { |
if (type == SOCK_STREAM) |
if (type == SOCK_STREAM) |
ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, NULL, buf, blen); |
ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, NULL, buf, blen); |
else |
else |
ret = rpc_Read(sock, type, 0, sa, buf, AIT_LEN(pkt)); | ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, sa, buf, blen); |
if (ret < 1) { | if (ret < 1) |
LOGERR; | |
return -1; |
return -1; |
} |
|
|
|
/* check for response from known address */ |
/* check for response from known address */ |
if (type == SOCK_STREAM && !estlen) { | if (!estlen) { |
/* 1st read for RPC header */ |
/* 1st read for RPC header */ |
if (ret < sizeof(struct tagRPCCall)) { |
if (ret < sizeof(struct tagRPCCall)) { |
rpc_SetErr(ERPCMISMATCH, "Short RPC packet %d bytes", ret); |
rpc_SetErr(ERPCMISMATCH, "Short RPC packet %d bytes", ret); |
Line 318 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
Line 318 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
} |
} |
|
|
/* calc estimated length */ |
/* calc estimated length */ |
rpc = (struct tagRPCCall*) buf; |
|
estlen = ntohl(rpc->call_len); |
estlen = ntohl(rpc->call_len); |
if (estlen > AIT_LEN(pkt)) |
if (estlen > AIT_LEN(pkt)) |
AIT_RE_BUF(pkt, estlen); |
AIT_RE_BUF(pkt, estlen); |
buf = AIT_GET_BUF(pkt); |
buf = AIT_GET_BUF(pkt); |
blen = estlen; |
|
rpc = (struct tagRPCCall*) buf; |
rpc = (struct tagRPCCall*) buf; |
|
blen = estlen; |
continue; |
continue; |
} |
} |
|
|
/* compiler optimize loop if while(0) and stop working 'continue' */ | /* compiler optimize loop if while(0) and stop working 'continue' on some platforms */ |
break; |
break; |
} while (42); |
} while (42); |
|
|
if (ret < sizeof(struct tagRPCCall)) { | if (ret < sizeof(struct tagRPCCall) || estlen != ret) { |
rpc_SetErr(ERPCMISMATCH, "Short RPC packet %d bytes", ret); | rpc_SetErr(ERPCMISMATCH, "RPC packet mismatch estimate %d bytes, but received %d\n", |
| estlen, ret); |
return -1; |
return -1; |
} |
} |
|
|
Line 380 rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t
|
Line 380 rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t
|
rpc->call_argc = htons(array_Size(vars)); |
rpc->call_argc = htons(array_Size(vars)); |
|
|
/* set reply */ |
/* set reply */ |
rpc->call_req.flags = noreply ? RPC_NOREPLY : RPC_REPLY; | rpc->call_req.flags = (uint64_t) htonl(noreply ? RPC_NOREPLY : RPC_REPLY); |
|
|
if (array_Size(vars)) { |
if (array_Size(vars)) { |
/* marshaling variables */ |
/* marshaling variables */ |