diff --git a/Assets/PatchKit Patcher/Library/PatchKit.Network.dll b/Assets/PatchKit Patcher/Library/PatchKit.Network.dll index 89e0dffa..ab41f4cb 100755 Binary files a/Assets/PatchKit Patcher/Library/PatchKit.Network.dll and b/Assets/PatchKit Patcher/Library/PatchKit.Network.dll differ diff --git a/Assets/PatchKit Patcher/Scripts/AppData/Remote/Downloaders/BaseHttpDownloader.cs b/Assets/PatchKit Patcher/Scripts/AppData/Remote/Downloaders/BaseHttpDownloader.cs index 46aa914e..a4b95a76 100644 --- a/Assets/PatchKit Patcher/Scripts/AppData/Remote/Downloaders/BaseHttpDownloader.cs +++ b/Assets/PatchKit Patcher/Scripts/AppData/Remote/Downloaders/BaseHttpDownloader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Net; using JetBrains.Annotations; @@ -79,7 +79,8 @@ public void Download(CancellationToken cancellationToken) { Address = new Uri(_url), Range = _bytesRange, - Timeout = _timeout + Timeout = _timeout, + ReadWriteTimeout = _timeout, }; using (var response = _httpClient.Get(request)) diff --git a/Assets/PatchKit Patcher/Scripts/Utilities/BytesRangeHelpers.cs b/Assets/PatchKit Patcher/Scripts/Utilities/BytesRangeHelpers.cs index 1cf54e29..d3bd3359 100644 --- a/Assets/PatchKit Patcher/Scripts/Utilities/BytesRangeHelpers.cs +++ b/Assets/PatchKit Patcher/Scripts/Utilities/BytesRangeHelpers.cs @@ -54,89 +54,5 @@ public static BytesRange Chunkify(this BytesRange range, ChunksData chunksData) return new BytesRange(bottom, top); } - - /// - /// Limits one range inside the other, examples: - /// 0:-1 contained in range 20:30 becomes 20:30. - /// 0:100 contained in range 50:-1 becomes 50:100 - /// - public static BytesRange ContainIn(this BytesRange range, BytesRange outer) - { - if (Contains(outer, range)) - { - return range; - } - - long start = range.Start; - long end = range.End; - - if (range.Start < outer.Start) - { - start = outer.Start; - } - - if (outer.End != -1) - { - if (range.End == -1 || range.End > outer.End) - { - end = outer.End; - } - } - - return Make(start, end); - } - - /// - /// Localizes one range inside another, the resulting range is limited and local to the relative ("parent") range - /// If the ranges don't overlap, an empty range will be returned. - /// Examples: - /// 50:95 localized within 10:90 becomes 40:-1 - /// 5:15 localized within 10:90 becomes 0:5 - /// - public static BytesRange LocalizeTo(this BytesRange range, BytesRange relative) - { - if (!Overlaps(range, relative)) - { - return Empty(); - } - - long localStart = range.Start >= relative.Start ? range.Start - relative.Start : 0; - long localEnd = range.End <= relative.End ? range.End - relative.Start : -1; - - if (range.End == -1) - { - localEnd = -1; - } - - return Make(localStart, localEnd); - } - - public static bool Overlaps(this BytesRange lhs, BytesRange rhs) - { - return Contains(lhs, rhs) - || Contains(rhs, lhs) - || Contains(lhs, rhs.Start) - || Contains(lhs, rhs.End); - } - - public static bool Contains(this BytesRange outer, BytesRange inner) - { - if (inner.End == -1 && outer.End != -1) - { - return false; - } - - if (inner.Start >= outer.Start) - { - return outer.End == -1 || inner.End <= outer.End; - } - - return false; - } - - public static bool Contains(this BytesRange range, long value) - { - return value >= range.Start && (range.End == -1 || value <= range.End); - } } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bacb745..0f6dea04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] +### Changed +- Patcher will timeout if the downloading stopped sooner than after 5 minutes + ## [3.10.1] ### Fixed - Updated torrent-client to fix the issue with paths with spaces in them