Commit eec47af6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Properly implement getsockopt(SO_CONNECT_TIME).

parent 4af902eb
...@@ -1424,6 +1424,14 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl ...@@ -1424,6 +1424,14 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return 0; 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: case SO_DEBUG:
WARN( "returning 0 for SO_DEBUG\n" ); WARN( "returning 0 for SO_DEBUG\n" );
*(DWORD *)optval = 0; *(DWORD *)optval = 0;
...@@ -1450,27 +1458,6 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl ...@@ -1450,27 +1458,6 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return ret; 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 /* As mentioned in setsockopt, Windows ignores this, so we
* always return true here */ * always return true here */
case SO_DONTROUTE: case SO_DONTROUTE:
......
...@@ -233,6 +233,7 @@ struct afd_get_events_params ...@@ -233,6 +233,7 @@ struct afd_get_events_params
#define IOCTL_AFD_WINE_SET_IPV6_RECVPKTINFO WINE_AFD_IOC(289) #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_GET_IPV6_RECVTCLASS WINE_AFD_IOC(290)
#define IOCTL_AFD_WINE_SET_IPV6_RECVTCLASS WINE_AFD_IOC(291) #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 struct afd_create_params
{ {
......
...@@ -2807,6 +2807,23 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) ...@@ -2807,6 +2807,23 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
return 0; 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: default:
set_error( STATUS_NOT_SUPPORTED ); set_error( STATUS_NOT_SUPPORTED );
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment