Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4ca53984
Commit
4ca53984
authored
Mar 08, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Mar 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Improve setup_connector_socket to allow non-blocking connect calls.
parent
9eaf92d6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
sock.c
dlls/ws2_32/tests/sock.c
+21
-8
No files found.
dlls/ws2_32/tests/sock.c
View file @
4ca53984
...
@@ -196,6 +196,9 @@ static int client_id;
...
@@ -196,6 +196,9 @@ static int client_id;
/**************** General utility functions ***************/
/**************** General utility functions ***************/
static
SOCKET
setup_server_socket
(
struct
sockaddr_in
*
addr
,
int
*
len
);
static
SOCKET
setup_connector_socket
(
struct
sockaddr_in
*
addr
,
int
len
,
BOOL
nonblock
);
static
int
tcp_socketpair
(
SOCKET
*
src
,
SOCKET
*
dst
)
static
int
tcp_socketpair
(
SOCKET
*
src
,
SOCKET
*
dst
)
{
{
SOCKET
server
=
INVALID_SOCKET
;
SOCKET
server
=
INVALID_SOCKET
;
...
@@ -3632,7 +3635,7 @@ static SOCKET setup_server_socket(struct sockaddr_in *addr, int *len)
...
@@ -3632,7 +3635,7 @@ static SOCKET setup_server_socket(struct sockaddr_in *addr, int *len)
return
server_socket
;
return
server_socket
;
}
}
static
SOCKET
setup_connector_socket
(
struct
sockaddr_in
*
addr
,
int
len
)
static
SOCKET
setup_connector_socket
(
struct
sockaddr_in
*
addr
,
int
len
,
BOOL
nonblock
)
{
{
int
ret
;
int
ret
;
SOCKET
connector
;
SOCKET
connector
;
...
@@ -3640,8 +3643,18 @@ static SOCKET setup_connector_socket(struct sockaddr_in *addr, int len)
...
@@ -3640,8 +3643,18 @@ static SOCKET setup_connector_socket(struct sockaddr_in *addr, int len)
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
connector
!=
INVALID_SOCKET
,
"failed to create connector socket %d
\n
"
,
WSAGetLastError
());
ok
(
connector
!=
INVALID_SOCKET
,
"failed to create connector socket %d
\n
"
,
WSAGetLastError
());
if
(
nonblock
)
set_blocking
(
connector
,
!
nonblock
);
ret
=
connect
(
connector
,
(
struct
sockaddr
*
)
addr
,
len
);
ret
=
connect
(
connector
,
(
struct
sockaddr
*
)
addr
,
len
);
if
(
!
nonblock
)
ok
(
!
ret
,
"connecting to accepting socket failed %d
\n
"
,
WSAGetLastError
());
ok
(
!
ret
,
"connecting to accepting socket failed %d
\n
"
,
WSAGetLastError
());
else
if
(
ret
==
SOCKET_ERROR
)
{
DWORD
error
=
WSAGetLastError
();
ok
(
error
==
WSAEWOULDBLOCK
||
error
==
WSAEINPROGRESS
,
"expected 10035 or 10036, got %d
\n
"
,
error
);
}
return
connector
;
return
connector
;
}
}
...
@@ -3669,7 +3682,7 @@ static void test_accept(void)
...
@@ -3669,7 +3682,7 @@ static void test_accept(void)
return
;
return
;
}
}
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
trace
(
"Blocking accept next
\n
"
);
trace
(
"Blocking accept next
\n
"
);
...
@@ -3717,7 +3730,7 @@ static void test_accept(void)
...
@@ -3717,7 +3730,7 @@ static void test_accept(void)
server_socket
=
setup_server_socket
(
&
address
,
&
socklen
);
server_socket
=
setup_server_socket
(
&
address
,
&
socklen
);
if
(
server_socket
==
INVALID_SOCKET
)
goto
done
;
if
(
server_socket
==
INVALID_SOCKET
)
goto
done
;
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
socklen
=
0
;
socklen
=
0
;
...
@@ -3728,7 +3741,7 @@ static void test_accept(void)
...
@@ -3728,7 +3741,7 @@ static void test_accept(void)
connector
=
INVALID_SOCKET
;
connector
=
INVALID_SOCKET
;
socklen
=
sizeof
(
address
);
socklen
=
sizeof
(
address
);
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
accepted
=
WSAAccept
(
server_socket
,
NULL
,
NULL
,
NULL
,
0
);
accepted
=
WSAAccept
(
server_socket
,
NULL
,
NULL
,
NULL
,
0
);
...
@@ -3738,7 +3751,7 @@ static void test_accept(void)
...
@@ -3738,7 +3751,7 @@ static void test_accept(void)
accepted
=
connector
=
INVALID_SOCKET
;
accepted
=
connector
=
INVALID_SOCKET
;
socklen
=
sizeof
(
address
);
socklen
=
sizeof
(
address
);
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
socklen
=
sizeof
(
ss
);
socklen
=
sizeof
(
ss
);
...
@@ -3752,7 +3765,7 @@ static void test_accept(void)
...
@@ -3752,7 +3765,7 @@ static void test_accept(void)
accepted
=
connector
=
INVALID_SOCKET
;
accepted
=
connector
=
INVALID_SOCKET
;
socklen
=
sizeof
(
address
);
socklen
=
sizeof
(
address
);
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
socklen
=
0
;
socklen
=
0
;
...
@@ -3763,7 +3776,7 @@ static void test_accept(void)
...
@@ -3763,7 +3776,7 @@ static void test_accept(void)
accepted
=
connector
=
INVALID_SOCKET
;
accepted
=
connector
=
INVALID_SOCKET
;
socklen
=
sizeof
(
address
);
socklen
=
sizeof
(
address
);
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
accepted
=
accept
(
server_socket
,
NULL
,
NULL
);
accepted
=
accept
(
server_socket
,
NULL
,
NULL
);
...
@@ -3773,7 +3786,7 @@ static void test_accept(void)
...
@@ -3773,7 +3786,7 @@ static void test_accept(void)
accepted
=
connector
=
INVALID_SOCKET
;
accepted
=
connector
=
INVALID_SOCKET
;
socklen
=
sizeof
(
address
);
socklen
=
sizeof
(
address
);
connector
=
setup_connector_socket
(
&
address
,
socklen
);
connector
=
setup_connector_socket
(
&
address
,
socklen
,
FALSE
);
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
if
(
connector
==
INVALID_SOCKET
)
goto
done
;
socklen
=
sizeof
(
ss
);
socklen
=
sizeof
(
ss
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment