Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
15cc3017
Commit
15cc3017
authored
Jul 31, 2010
by
Mike Kaplinskiy
Committed by
Alexandre Julliard
Aug 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Create a wrapper for connect.
parent
fae0b6fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
27 deletions
+32
-27
socket.c
dlls/ws2_32/socket.c
+32
-27
No files found.
dlls/ws2_32/socket.c
View file @
15cc3017
...
...
@@ -1803,6 +1803,33 @@ int WINAPI WS_closesocket(SOCKET s)
return
SOCKET_ERROR
;
}
static
int
do_connect
(
int
fd
,
const
struct
WS_sockaddr
*
name
,
int
namelen
)
{
union
generic_unix_sockaddr
uaddr
;
unsigned
int
uaddrlen
=
ws_sockaddr_ws2u
(
name
,
namelen
,
&
uaddr
);
if
(
!
uaddrlen
)
return
WSAEFAULT
;
if
(
name
->
sa_family
==
WS_AF_INET
)
{
struct
sockaddr_in
*
in4
=
(
struct
sockaddr_in
*
)
&
uaddr
;
if
(
memcmp
(
&
in4
->
sin_addr
,
magic_loopback_addr
,
4
)
==
0
)
{
/* Trying to connect to magic replace-loopback address,
* assuming we really want to connect to localhost */
TRACE
(
"Trying to connect to magic IP address, using "
"INADDR_LOOPBACK instead.
\n
"
);
in4
->
sin_addr
.
s_addr
=
htonl
(
WS_INADDR_LOOPBACK
);
}
}
if
(
connect
(
fd
,
&
uaddr
.
addr
,
uaddrlen
)
==
0
)
return
0
;
return
wsaErrno
();
}
/***********************************************************************
* connect (WS2_32.4)
*/
...
...
@@ -1814,33 +1841,11 @@ int WINAPI WS_connect(SOCKET s, const struct WS_sockaddr* name, int namelen)
if
(
fd
!=
-
1
)
{
union
generic_unix_sockaddr
uaddr
;
unsigned
int
uaddrlen
=
ws_sockaddr_ws2u
(
name
,
namelen
,
&
uaddr
);
int
ret
=
do_connect
(
fd
,
name
,
namelen
);
if
(
ret
==
0
)
goto
connect_success
;
if
(
!
uaddrlen
)
{
SetLastError
(
WSAEFAULT
);
}
else
{
if
(
name
->
sa_family
==
WS_AF_INET
)
{
struct
sockaddr_in
*
in4
=
(
struct
sockaddr_in
*
)
&
uaddr
;
if
(
memcmp
(
&
in4
->
sin_addr
,
magic_loopback_addr
,
4
)
==
0
)
{
/* Trying to connect to magic replace-loopback address,
* assuming we really want to connect to localhost */
TRACE
(
"Trying to connect to magic IP address, using "
"INADDR_LOOPBACK instead.
\n
"
);
in4
->
sin_addr
.
s_addr
=
htonl
(
WS_INADDR_LOOPBACK
);
}
}
if
(
connect
(
fd
,
&
uaddr
.
addr
,
uaddrlen
)
==
0
)
goto
connect_success
;
}
if
(
errno
==
EINPROGRESS
)
if
(
ret
==
WSAEINPROGRESS
)
{
/* tell wineserver that a connection is in progress */
_enable_event
(
SOCKET2HANDLE
(
s
),
FD_CONNECT
|
FD_READ
|
FD_WRITE
,
...
...
@@ -1868,7 +1873,7 @@ int WINAPI WS_connect(SOCKET s, const struct WS_sockaddr* name, int namelen)
}
else
{
SetLastError
(
wsaErrno
()
);
SetLastError
(
ret
);
}
release_sock_fd
(
s
,
fd
);
}
...
...
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