winhttp(3/6): Use connection's timeout rather than default timeout when reading a line
Juan Lang
juan.lang at gmail.com
Tue Jul 21 16:55:28 CDT 2009
--Juan
-------------- next part --------------
From 106be2ce7aaddee384179c4d54cdef277faef304 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Tue, 21 Jul 2009 13:53:11 -0700
Subject: [PATCH 07/10] 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 ) );
--
1.6.3.2
More information about the wine-patches
mailing list