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
6a80fe9e
Commit
6a80fe9e
authored
Apr 27, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Call get_rcvsnd_timeo directly.
parent
9e3a3f46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
socket.c
dlls/ws2_32/socket.c
+16
-14
No files found.
dlls/ws2_32/socket.c
View file @
6a80fe9e
...
...
@@ -1252,29 +1252,31 @@ static char *strdup_lower(const char *str)
/* Utility: get the SO_RCVTIMEO or SO_SNDTIMEO socket option
* from an fd and return the value converted to milli seconds
* or 0 if there is an infinite time out */
static
inline
INT64
get_rcvsnd_timeo
(
int
fd
,
int
optname
)
static
inline
INT64
get_rcvsnd_timeo
(
int
fd
,
BOOL
is_recv
)
{
struct
timeval
tv
;
socklen_t
len
=
sizeof
(
tv
);
int
res
=
getsockopt
(
fd
,
SOL_SOCKET
,
optname
,
&
tv
,
&
len
);
if
(
res
<
0
)
return
0
;
return
(
UINT64
)
tv
.
tv_sec
*
1000
+
tv
.
tv_usec
/
1000
;
}
int
optname
,
res
;
/* macro wrappers for portability */
if
(
is_recv
)
#ifdef SO_RCVTIMEO
#define GET_RCVTIMEO(fd) get_rcvsnd_timeo( (fd), SO_RCVTIMEO)
optname
=
SO_RCVTIMEO
;
#else
#define GET_RCVTIMEO(fd) (0)
return
0
;
#endif
else
#ifdef SO_SNDTIMEO
#define GET_SNDTIMEO(fd) get_rcvsnd_timeo( (fd), SO_SNDTIMEO)
optname
=
SO_SNDTIMEO
;
#else
#define GET_SNDTIMEO(fd) (0)
return
0
;
#endif
res
=
getsockopt
(
fd
,
SOL_SOCKET
,
optname
,
&
tv
,
&
len
);
if
(
res
<
0
)
return
0
;
return
(
UINT64
)
tv
.
tv_sec
*
1000
+
tv
.
tv_usec
/
1000
;
}
/* utility: given an fd, will block until one of the events occurs */
static
inline
int
do_block
(
int
fd
,
int
events
,
int
timeout
)
{
...
...
@@ -5075,7 +5077,7 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
{
struct
pollfd
pfd
;
int
poll_timeout
=
-
1
;
INT64
timeout
=
GET_SNDTIMEO
(
fd
);
INT64
timeout
=
get_rcvsnd_timeo
(
fd
,
FALSE
);
if
(
timeout
)
{
...
...
@@ -7131,7 +7133,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
{
struct
pollfd
pfd
;
int
poll_timeout
=
-
1
;
INT64
timeout
=
GET_RCVTIMEO
(
fd
);
INT64
timeout
=
get_rcvsnd_timeo
(
fd
,
TRUE
);
if
(
timeout
)
{
...
...
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