mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:50:21 +00:00
ws2_32: Properly implement getsockopt(SO_CONNECT_TIME).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4af902eb4e
commit
eec47af638
|
@ -1424,6 +1424,14 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
|
|||
return 0;
|
||||
}
|
||||
|
||||
case SO_CONNECT_TIME:
|
||||
if (!optlen || !optval)
|
||||
{
|
||||
SetLastError( WSAEFAULT );
|
||||
return -1;
|
||||
}
|
||||
return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_CONNECT_TIME, optval, optlen );
|
||||
|
||||
case SO_DEBUG:
|
||||
WARN( "returning 0 for SO_DEBUG\n" );
|
||||
*(DWORD *)optval = 0;
|
||||
|
@ -1450,27 +1458,6 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
|
|||
return ret;
|
||||
}
|
||||
|
||||
case SO_CONNECT_TIME:
|
||||
{
|
||||
static int pretendtime = 0;
|
||||
struct sockaddr addr;
|
||||
int len = sizeof(addr);
|
||||
|
||||
if (!optlen || *optlen < sizeof(DWORD) || !optval)
|
||||
{
|
||||
SetLastError(WSAEFAULT);
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
if (getpeername(s, &addr, &len) == SOCKET_ERROR)
|
||||
*(DWORD *)optval = ~0u;
|
||||
else
|
||||
{
|
||||
if (!pretendtime) FIXME("SO_CONNECT_TIME - faking results\n");
|
||||
*(DWORD *)optval = pretendtime++;
|
||||
}
|
||||
*optlen = sizeof(DWORD);
|
||||
return ret;
|
||||
}
|
||||
/* As mentioned in setsockopt, Windows ignores this, so we
|
||||
* always return true here */
|
||||
case SO_DONTROUTE:
|
||||
|
|
|
@ -233,6 +233,7 @@ struct afd_get_events_params
|
|||
#define IOCTL_AFD_WINE_SET_IPV6_RECVPKTINFO WINE_AFD_IOC(289)
|
||||
#define IOCTL_AFD_WINE_GET_IPV6_RECVTCLASS WINE_AFD_IOC(290)
|
||||
#define IOCTL_AFD_WINE_SET_IPV6_RECVTCLASS WINE_AFD_IOC(291)
|
||||
#define IOCTL_AFD_WINE_GET_SO_CONNECT_TIME WINE_AFD_IOC(292)
|
||||
|
||||
struct afd_create_params
|
||||
{
|
||||
|
|
|
@ -2807,6 +2807,23 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
return 0;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_CONNECT_TIME:
|
||||
{
|
||||
DWORD time = ~0u;
|
||||
|
||||
if (get_reply_max_size() < sizeof(time))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sock->state == SOCK_CONNECTED)
|
||||
time = (current_time - sock->connect_time) / 10000000;
|
||||
|
||||
set_reply_data( &time, sizeof(time) );
|
||||
return 1;
|
||||
}
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue