remove expired tls

This commit is contained in:
2dust 2022-04-11 19:16:35 +08:00
parent 815826c856
commit e95b5e04c0
2 changed files with 5 additions and 10 deletions

View file

@ -183,7 +183,7 @@ namespace v2rayN.Base
using (var stream = await response.Content.ReadAsStreamAsync()) using (var stream = await response.Content.ReadAsStreamAsync())
{ {
var totalRead = 0L; var totalRead = 0L;
var buffer = new byte[1024 * 1024]; var buffer = new byte[1024 * 128];
var isMoreToRead = true; var isMoreToRead = true;
progressPercentage = -1; progressPercentage = -1;
DateTime totalDatetime = DateTime.Now; DateTime totalDatetime = DateTime.Now;
@ -211,14 +211,14 @@ namespace v2rayN.Base
TimeSpan ts = (DateTime.Now - totalDatetime); TimeSpan ts = (DateTime.Now - totalDatetime);
var speed = totalRead * 1d / ts.TotalMilliseconds / 1000; var speed = totalRead * 1d / ts.TotalMilliseconds / 1000;
var percent = Convert.ToInt32((totalRead * 1d) / (total * 1d) * 100); var percent = Convert.ToInt32((totalRead * 1d) / (total * 1d) * 100);
if (progressPercentage != percent && percent % 5 == 0) if (progressPercentage != percent && percent % 2 == 1)
{ {
progressPercentage = percent; progressPercentage = percent;
progress.Report(speed); progress.Report(speed);
} }
} }
} }
} while (isMoreToRead); } while (isMoreToRead);
} }
} }

View file

@ -753,16 +753,11 @@ namespace v2rayN
{ {
if (enableSecurityProtocolTls13) if (enableSecurityProtocolTls13)
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Tls13;
} }
else else
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12;
} }
ServicePointManager.DefaultConnectionLimit = 256; ServicePointManager.DefaultConnectionLimit = 256;
} }