SOCKET: Use recv/send for all socket io on all platforms
instead of only on windows and aros and read/write on the otherslibnfs-4.0.0-vitalif
parent
18337b7151
commit
099be710b6
12
lib/socket.c
12
lib/socket.c
|
@ -118,11 +118,7 @@ static int rpc_write_to_socket(struct rpc_context *rpc)
|
|||
|
||||
total = rpc->outqueue->outdata.size;
|
||||
|
||||
#if defined(WIN32) | defined(AROS)
|
||||
count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0);
|
||||
#else
|
||||
count = write(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written);
|
||||
#endif
|
||||
if (count == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
return 0;
|
||||
|
@ -202,11 +198,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
|
|||
if (rpc->inpos < 4) {
|
||||
size = 4 - rpc->inpos;
|
||||
|
||||
#if defined(WIN32) | defined(AROS)
|
||||
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
|
||||
#else
|
||||
count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
|
||||
#endif
|
||||
if (count == -1) {
|
||||
if (errno == EINTR) {
|
||||
return 0;
|
||||
|
@ -242,11 +234,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
|
|||
size = rpc->insize - rpc->inpos;
|
||||
}
|
||||
|
||||
#if defined(WIN32) | defined(AROS)
|
||||
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
|
||||
#else
|
||||
count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
|
||||
#endif
|
||||
if (count == -1) {
|
||||
if (errno == EINTR) {
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue