Jacek Caban : wininet: Pass blocking mode to HTTPREQ_Read.

Alexandre Julliard julliard at winehq.org
Fri Mar 10 16:51:43 CST 2017


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Mar  9 18:18:21 2017 +0100

wininet: Pass blocking mode to HTTPREQ_Read.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wininet/http.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 26f7f87..fcd8d50 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3028,14 +3028,11 @@ static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif, DWORD
 }
 
 /* read data from the http connection (the read section must be held) */
-static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *read)
+static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *read, blocking_mode_t blocking_mode)
 {
     DWORD current_read = 0, ret_read = 0;
-    blocking_mode_t blocking_mode;
     DWORD res = ERROR_SUCCESS;
 
-    blocking_mode = req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC ? BLOCKING_ALLOW : BLOCKING_WAITALL;
-
     EnterCriticalSection( &req->read_section );
 
     if(req->read_size) {
@@ -3082,7 +3079,7 @@ static BOOL drain_content(http_request_t *req, BOOL blocking)
         DWORD bytes_read, res;
         BYTE buf[4096];
 
-        res = HTTPREQ_Read(req, buf, sizeof(buf), &bytes_read);
+        res = HTTPREQ_Read(req, buf, sizeof(buf), &bytes_read, BLOCKING_ALLOW);
         if(res != ERROR_SUCCESS) {
             ret = FALSE;
             break;
@@ -3113,7 +3110,7 @@ static void AsyncReadFileExProc(task_header_t *hdr)
     TRACE("%p\n", req);
 
     if(task->ret_read)
-        res = HTTPREQ_Read(req, task->buf, task->size, &read);
+        res = HTTPREQ_Read(req, task->buf, task->size, &read, BLOCKING_ALLOW);
     if(res == ERROR_SUCCESS)
         res = refill_read_buffer(req, task->ret_read ? BLOCKING_DISALLOW : BLOCKING_ALLOW, &buffered);
     if (res == ERROR_SUCCESS)
@@ -3150,7 +3147,7 @@ static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWO
         {
             if (get_avail_data(req) || end_of_read_data(req))
             {
-                res = HTTPREQ_Read(req, buf, size, &read);
+                res = HTTPREQ_Read(req, buf, size, &read, BLOCKING_DISALLOW);
                 LeaveCriticalSection( &req->read_section );
                 goto done;
             }
@@ -3176,7 +3173,7 @@ static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWO
         hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
 
     while(1) {
-        res = HTTPREQ_Read(req, (char*)buf+read, size-read, &cread);
+        res = HTTPREQ_Read(req, (char*)buf+read, size-read, &cread, BLOCKING_ALLOW);
         if(res != ERROR_SUCCESS)
             break;
 
@@ -3240,7 +3237,7 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
         {
             if (get_avail_data(req) || end_of_read_data(req))
             {
-                res = HTTPREQ_Read(req, buffer, size, read);
+                res = HTTPREQ_Read(req, buffer, size, read, BLOCKING_DISALLOW);
                 LeaveCriticalSection( &req->read_section );
                 return res;
             }
@@ -3262,7 +3259,7 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
     if(hdr->dwError == INTERNET_HANDLE_IN_USE)
         hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
 
-    res = HTTPREQ_Read(req, buffer, size, read);
+    res = HTTPREQ_Read(req, buffer, size, read, BLOCKING_WAITALL);
     if(res == ERROR_SUCCESS)
         res = hdr->dwError;
     LeaveCriticalSection( &req->read_section );




More information about the wine-cvs mailing list