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
8a15ea11
Commit
8a15ea11
authored
Jun 12, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Jun 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Use a helper to receive data and take care of EINTR.
parent
d4278ce0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
11 deletions
+23
-11
ftp.c
dlls/wininet/ftp.c
+4
-4
internet.c
dlls/wininet/internet.c
+1
-1
internet.h
dlls/wininet/internet.h
+1
-0
netconnection.c
dlls/wininet/netconnection.c
+17
-6
No files found.
dlls/wininet/ftp.c
View file @
8a15ea11
...
...
@@ -1195,7 +1195,7 @@ static DWORD FTPFILE_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
return
ERROR_INTERNET_DISCONNECTED
;
/* FIXME: FTP should use NETCON_ stuff */
res
=
recv
(
file
->
nDataSocket
,
buffer
,
size
,
MSG_WAITALL
);
res
=
sock_
recv
(
file
->
nDataSocket
,
buffer
,
size
,
MSG_WAITALL
);
*
read
=
res
>
0
?
res
:
0
;
error
=
res
>=
0
?
ERROR_SUCCESS
:
INTERNET_ERROR_BASE
;
/* FIXME */
...
...
@@ -1234,7 +1234,7 @@ static void FTP_ReceiveRequestData(ftp_file_t *file, BOOL first_notif)
TRACE
(
"%p
\n
"
,
file
);
available
=
recv
(
file
->
nDataSocket
,
buffer
,
sizeof
(
buffer
),
MSG_PEEK
);
available
=
sock_
recv
(
file
->
nDataSocket
,
buffer
,
sizeof
(
buffer
),
MSG_PEEK
);
if
(
available
!=
-
1
)
{
iar
.
dwResult
=
(
DWORD_PTR
)
file
->
hdr
.
hInternet
;
...
...
@@ -1277,7 +1277,7 @@ static DWORD FTPFILE_QueryDataAvailable(object_header_t *hdr, DWORD *available,
*
available
=
0
;
retval
=
recv
(
file
->
nDataSocket
,
&
byte
,
1
,
MSG_PEEK
);
retval
=
sock_
recv
(
file
->
nDataSocket
,
&
byte
,
1
,
MSG_PEEK
);
if
(
retval
>
0
)
{
task_header_t
*
task
;
...
...
@@ -3368,7 +3368,7 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h
while
(
nRC
!=
-
1
)
{
nRC
=
recv
(
nDataSocket
,
lpszBuffer
,
DATA_PACKET_SIZE
,
0
);
nRC
=
sock_
recv
(
nDataSocket
,
lpszBuffer
,
DATA_PACKET_SIZE
,
0
);
if
(
nRC
!=
-
1
)
{
/* other side closed socket. */
...
...
dlls/wininet/internet.c
View file @
8a15ea11
...
...
@@ -3928,7 +3928,7 @@ LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
{
if
(
poll
(
&
pfd
,
1
,
RESPONSE_TIMEOUT
*
1000
)
>
0
)
{
if
(
recv
(
nSocket
,
&
lpszBuffer
[
nRecv
],
1
,
0
)
<=
0
)
if
(
sock_
recv
(
nSocket
,
&
lpszBuffer
[
nRecv
],
1
,
0
)
<=
0
)
{
INTERNET_SetLastError
(
ERROR_FTP_TRANSFER_IN_PROGRESS
);
goto
lend
;
...
...
dlls/wininet/internet.h
View file @
8a15ea11
...
...
@@ -458,6 +458,7 @@ int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
DWORD
NETCON_set_timeout
(
netconn_t
*
connection
,
BOOL
send
,
DWORD
value
)
DECLSPEC_HIDDEN
;
int
sock_get_error
(
int
)
DECLSPEC_HIDDEN
;
int
sock_send
(
int
fd
,
const
void
*
msg
,
size_t
len
,
int
flags
)
DECLSPEC_HIDDEN
;
int
sock_recv
(
int
fd
,
void
*
msg
,
size_t
len
,
int
flags
)
DECLSPEC_HIDDEN
;
server_t
*
get_server
(
const
WCHAR
*
,
INTERNET_PORT
,
BOOL
,
BOOL
);
...
...
dlls/wininet/netconnection.c
View file @
8a15ea11
...
...
@@ -507,6 +507,17 @@ int sock_send(int fd, const void *msg, size_t len, int flags)
return
ret
;
}
int
sock_recv
(
int
fd
,
void
*
msg
,
size_t
len
,
int
flags
)
{
int
ret
;
do
{
ret
=
recv
(
fd
,
msg
,
len
,
flags
);
}
while
(
ret
==
-
1
&&
errno
==
EINTR
);
return
ret
;
}
static
void
set_socket_blocking
(
int
socket
,
blocking_mode_t
mode
)
{
#if defined(__MINGW32__) || defined (_MSC_VER)
...
...
@@ -596,7 +607,7 @@ static DWORD netcon_secure_connect_setup(netconn_t *connection, BOOL compat_mode
read_buf_size
+=
1024
;
}
size
=
recv
(
connection
->
socket
,
read_buf
+
in_bufs
[
0
].
cbBuffer
,
read_buf_size
-
in_bufs
[
0
].
cbBuffer
,
0
);
size
=
sock_
recv
(
connection
->
socket
,
read_buf
+
in_bufs
[
0
].
cbBuffer
,
read_buf_size
-
in_bufs
[
0
].
cbBuffer
,
0
);
if
(
size
<
1
)
{
WARN
(
"recv error
\n
"
);
res
=
ERROR_INTERNET_SECURITY_CHANNEL_ERROR
;
...
...
@@ -799,7 +810,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking
tmp_mode
=
buf_len
?
BLOCKING_DISALLOW
:
mode
;
set_socket_blocking
(
conn
->
socket
,
tmp_mode
);
size
=
recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
tmp_mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
size
=
sock_
recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
tmp_mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
if
(
size
<
0
)
{
if
(
!
buf_len
)
{
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
...
...
@@ -840,7 +851,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking
assert
(
buf_len
<
ssl_buf_size
);
set_socket_blocking
(
conn
->
socket
,
mode
);
size
=
recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
size
=
sock_
recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
if
(
size
<
1
)
{
if
(
size
<
0
&&
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
))
{
TRACE
(
"would block
\n
"
);
...
...
@@ -924,7 +935,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t
}
set_socket_blocking
(
connection
->
socket
,
mode
);
*
recvd
=
recv
(
connection
->
socket
,
buf
,
len
,
flags
);
*
recvd
=
sock_
recv
(
connection
->
socket
,
buf
,
len
,
flags
);
return
*
recvd
==
-
1
?
sock_get_error
(
errno
)
:
ERROR_SUCCESS
;
}
else
...
...
@@ -1012,7 +1023,7 @@ BOOL NETCON_is_alive(netconn_t *netconn)
ssize_t
len
;
BYTE
b
;
len
=
recv
(
netconn
->
socket
,
&
b
,
1
,
MSG_PEEK
|
MSG_DONTWAIT
);
len
=
sock_
recv
(
netconn
->
socket
,
&
b
,
1
,
MSG_PEEK
|
MSG_DONTWAIT
);
return
len
==
1
||
(
len
==
-
1
&&
errno
==
EWOULDBLOCK
);
#elif defined(__MINGW32__) || defined(_MSC_VER)
ULONG
mode
;
...
...
@@ -1023,7 +1034,7 @@ BOOL NETCON_is_alive(netconn_t *netconn)
if
(
!
ioctlsocket
(
netconn
->
socket
,
FIONBIO
,
&
mode
))
return
FALSE
;
len
=
recv
(
netconn
->
socket
,
&
b
,
1
,
MSG_PEEK
);
len
=
sock_
recv
(
netconn
->
socket
,
&
b
,
1
,
MSG_PEEK
);
mode
=
0
;
if
(
!
ioctlsocket
(
netconn
->
socket
,
FIONBIO
,
&
mode
))
...
...
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