1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00

Updated WSARecvEx to work with SPX sockets.

This commit is contained in:
Daniel Collins 2014-01-05 20:59:46 +00:00
parent 714543fac5
commit ef65d64edc

View File

@ -683,26 +683,43 @@ int WSAAPI recv(SOCKET fd, char *buf, int len, int flags)
} }
} }
int PASCAL WSARecvEx(SOCKET fd, char *buf, int len, int *flags) { int PASCAL WSARecvEx(SOCKET fd, char *buf, int len, int *flags)
ipx_socket *sockptr = get_socket(fd); {
ipx_socket *sock = get_socket(fd);
if(sockptr) { if(sock)
int rval = recv_packet(sockptr, buf, len, 0, NULL, 0); {
if(sock->flags & IPX_IS_SPX)
if(rval > len) { {
*flags = MSG_PARTIAL; unlock_sockets();
/* Wording of MSDN is unclear on what should be returned when return r_WSARecvEx(fd, buf, len, flags);
* an incomplete message is read, I think it should return the
* amount of data copied to the buffer.
*/
rval = len;
}else if(rval != -1) {
*flags = 0;
} }
else{
return rval; int rval = recv_packet(sock, buf, len, 0, NULL, 0);
}else{
if(rval > len)
{
*flags = MSG_PARTIAL;
/* Wording of MSDN is unclear on what should be
* returned when a partial packet is read.
*
* I _THINK_ it should return the amount of data
* actually copied to the buffer.
*/
rval = len;
}
else if(rval != -1)
{
*flags = 0;
}
return rval;
}
}
else{
return r_WSARecvEx(fd, buf, len, flags); return r_WSARecvEx(fd, buf, len, flags);
} }
} }