Skip to content

Commit 3878e9c

Browse files
Fix a scenario when network is destroyed and user callback is not triggered.
Resolves: OLPEDGE-1160 Signed-off-by: Mykhailo Kuchma <[email protected]>
1 parent 2084d8f commit 3878e9c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

olp-cpp-sdk-core/src/http/winhttp/NetworkWinHttp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ void NetworkWinHttp::RequestCallback(HINTERNET, DWORD_PTR context, DWORD status,
577577
OLP_SDK_LOG_WARNING(kLogTag, "WinHttpReceiveResponse failed, id="
578578
<< handle->request_id
579579
<< ", error=" << GetLastError());
580+
handle->Complete();
580581
}
581582
} else if (status == WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE) {
582583
Network::HeaderCallback callback = nullptr;
@@ -773,6 +774,7 @@ void NetworkWinHttp::RequestCallback(HINTERNET, DWORD_PTR context, DWORD status,
773774
OLP_SDK_LOG_WARNING(kLogTag, "WinHttpReadData failed, id="
774775
<< handle->request_id
775776
<< ", error=" << GetLastError());
777+
handle->Complete();
776778
}
777779
} else {
778780
// Request is complete
@@ -875,6 +877,7 @@ void NetworkWinHttp::RequestCallback(HINTERNET, DWORD_PTR context, DWORD status,
875877
OLP_SDK_LOG_WARNING(kLogTag, "WinHttpQueryDataAvailable failed, id="
876878
<< handle->request_id
877879
<< ", error=" << GetLastError());
880+
handle->Complete();
878881
}
879882
} else if (status == WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING) {
880883
// Only now is it safe to free the handle

0 commit comments

Comments
 (0)