Hans Leidekker : webservices: Don't use MSG_PEEK.
Alexandre Julliard
julliard at winehq.org
Thu Nov 1 16:33:52 CDT 2018
Module: wine
Branch: master
Commit: 481ee636c1cc627fb7b6c20263fea778dde000cc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=481ee636c1cc627fb7b6c20263fea778dde000cc
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Nov 1 10:16:32 2018 +0100
webservices: Don't use MSG_PEEK.
As suggested by Jacek.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/channel.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 94c3dc1..b945c7f 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -1150,27 +1150,21 @@ static void set_blocking( SOCKET socket, BOOL blocking )
ioctlsocket( socket, FIONBIO, &state );
}
-static int sock_peek( SOCKET socket )
+static int sock_recv( SOCKET socket, char *buf, int len )
{
- int ret;
- char byte;
+ int count, ret;
- set_blocking( socket, FALSE );
- ret = recv( socket, &byte, 1, MSG_PEEK );
- set_blocking( socket, TRUE );
- return ret;
-}
+ if ((ret = recv( socket, buf, len, 0 )) <= 0) return ret;
+ len -= ret;
-static int sock_recv( SOCKET socket, char *buf, int len )
-{
- int count, ret = 0;
+ set_blocking( socket, FALSE );
for (;;)
{
if ((count = recv( socket, buf + ret, len, 0 )) <= 0) break;
ret += count;
len -= count;
- if (sock_peek( socket ) != 1) break;
}
+ set_blocking( socket, TRUE );
return ret;
}
More information about the wine-cvs
mailing list