urlmon: Avoid multiple InternetQueryDataAvailable calls in pending state.
This commit is contained in:
parent
eaaf157f6c
commit
dd61ebe6cf
|
@ -335,7 +335,7 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
|
||||||
protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE;
|
protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) {
|
if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA && !protocol->available_bytes) {
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
|
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
|
||||||
|
@ -367,13 +367,12 @@ HRESULT protocol_read(Protocol *protocol, void *buf, ULONG size, ULONG *read_ret
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(protocol->flags & FLAG_REQUEST_COMPLETE)) {
|
if(!(protocol->flags & FLAG_REQUEST_COMPLETE) || !protocol->available_bytes) {
|
||||||
*read_ret = 0;
|
*read_ret = 0;
|
||||||
return E_PENDING;
|
return E_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(read < size) {
|
while(read < size && protocol->available_bytes) {
|
||||||
if(protocol->available_bytes) {
|
|
||||||
ULONG len;
|
ULONG len;
|
||||||
|
|
||||||
res = InternetReadFile(protocol->request, ((BYTE *)buf)+read,
|
res = InternetReadFile(protocol->request, ((BYTE *)buf)+read,
|
||||||
|
@ -393,7 +392,8 @@ HRESULT protocol_read(Protocol *protocol, void *buf, ULONG size, ULONG *read_ret
|
||||||
read += len;
|
read += len;
|
||||||
protocol->current_position += len;
|
protocol->current_position += len;
|
||||||
protocol->available_bytes -= len;
|
protocol->available_bytes -= len;
|
||||||
}else {
|
|
||||||
|
if(!protocol->available_bytes) {
|
||||||
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
|
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
|
||||||
* read, so clear the flag _before_ calling so it does not incorrectly get cleared
|
* read, so clear the flag _before_ calling so it does not incorrectly get cleared
|
||||||
* after the status callback is called */
|
* after the status callback is called */
|
||||||
|
|
Loading…
Reference in New Issue