Closed alexiscatnip closed 2 years ago
btw the timeout.Infinite value is taken from https://docs.microsoft.com/en-us/dotnet/api/system.net.servicepoint.maxidletime?view=net-6.0
I honestly don't know why it's being set to zero there. Not sure if they meant to set Infinite. The comment mentions 60 seconds, so that's what I'm setting it at. Will be updated in 1.9.19
In DownloadManager.SetupRequest(), does it make sense to change
request.ServicePoint.MaxIdleTime = 0;
torequest.ServicePoint.MaxIdleTime = Timeout.Infinite;
or maybe change it to the value used for CapsBase:request.ServicePoint.MaxIdleTime = 60 * 1000;
I am running the library on Unity editor in windows, and my main thread blocks if this value is set to 0. (the debugger will enter BeginGetResponse() and staying there for minutes, accumulating RAM and eventually even blue screening my pc) On the other hand, both 60*1000 and Infinite are ok in my testing.
I will do more testing and confirm what's causing this issue and if its unity specific. Even if the underlying runtime/compiler interpret the 0 as literally '0 seconds' (instead of infinite). BeginGetResponse() should not be blocking UI thread, i think.