-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94bc901
commit 67f53a0
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -963,9 +963,9 @@ private async Task StartRequestAsync(WinHttpRequestState state) | |
// call of the response body data. WINHTTP_OPTION_RECEIVE_TIMEOUT sets a timeout on each | ||
// lower layer winsock read. | ||
// Timeout.InfiniteTimeSpan will be converted to uint.MaxValue milliseconds (~ 50 days). | ||
// The result a of double->uint cast is unspecified and may differ on ARM. | ||
// The result a of double->uint cast is unspecified and may differ on ARM, returning 0 instead of uint.MaxValue. | ||
// To handle Timeout.InfiniteTimespan correctly, we need to cast to Int32 first. | ||
uint optionData = unchecked((uint)(int)_receiveDataTimeout.TotalMilliseconds); | ||
uint optionData = (uint)(int)_receiveDataTimeout.TotalMilliseconds; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
antonfirsov
Author
Member
|
||
SetWinHttpOption(state.RequestHandle, Interop.WinHttp.WINHTTP_OPTION_RECEIVE_TIMEOUT, ref optionData); | ||
|
||
HttpResponseMessage responseMessage = | ||
|
@@ -1010,10 +1010,10 @@ private unsafe void SetTcpKeepalive(SafeWinHttpHandle sessionHandle) | |
onoff = 1, | ||
|
||
// Timeout.InfiniteTimeSpan will be converted to uint.MaxValue milliseconds (~ 50 days) | ||
// The result a of double->uint cast is unspecified and may differ on ARM. | ||
// The result a of double->uint cast is unspecified and may differ on ARM, returning 0 instead of uint.MaxValue. | ||
// To handle Timeout.InfiniteTimespan correctly, we need to cast to Int32 first. | ||
keepaliveinterval = unchecked((uint)(int)_tcpKeepAliveInterval.TotalMilliseconds), | ||
keepalivetime = unchecked((uint)(int)_tcpKeepAliveTime.TotalMilliseconds) | ||
keepaliveinterval = (uint)(int)_tcpKeepAliveInterval.TotalMilliseconds, | ||
keepalivetime = (uint)(int)_tcpKeepAliveTime.TotalMilliseconds | ||
}; | ||
|
||
SetWinHttpOption( | ||
|
Are there other corner cases where this can overflow in unspecified way? E.g. Can
TotalMilliseconds
be be 100 days?