Juan Lang : winhttp: Use connection' s timeout rather than default timeout when reading a line.

Alexandre Julliard julliard at winehq.org
Wed Jul 22 09:34:19 CDT 2009


Module: wine
Branch: master
Commit: 2418e82810a6caa594a7071dc5d85ef4e73b3ab0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2418e82810a6caa594a7071dc5d85ef4e73b3ab0

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Jul 21 13:53:11 2009 -0700

winhttp: Use connection's timeout rather than default timeout when reading a line.

---

 dlls/winhttp/net.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 181ff02..94bfd89 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -519,9 +519,16 @@ BOOL netconn_get_next_line( netconn_t *conn, char *buffer, DWORD *buflen )
     pfd.events = POLLIN;
     while (recvd < *buflen)
     {
-        if (poll( &pfd, 1, DEFAULT_RECEIVE_TIMEOUT * 1000 ) > 0)
+        int timeout, res;
+        struct timeval tv;
+        socklen_t len = sizeof(tv);
+
+        if ((res = getsockopt( conn->socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, &len ) != -1))
+            timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+        else
+            timeout = -1;
+        if (poll( &pfd, 1, timeout ) > 0)
         {
-            int res;
             if ((res = recv( conn->socket, &buffer[recvd], 1, 0 )) <= 0)
             {
                 if (res == -1) set_last_error( sock_get_error( errno ) );




More information about the wine-cvs mailing list