Skip to content

Commit

Permalink
B66 final after testing
Browse files Browse the repository at this point in the history
- Update MapLib to comply with OSM tile policy (2 concurrent DL only)
- Update QuickGuide
  • Loading branch information
bm98 committed Aug 24, 2023
1 parent cce3d4b commit 677dab9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions FSimMap/MapLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "0.1.0.9" )]
[assembly: AssemblyFileVersion( "0.1.0.9" )]
[assembly: AssemblyVersion( "0.2.0.10" )]
[assembly: AssemblyFileVersion( "0.2.0.10" )]
2 changes: 1 addition & 1 deletion FSimMap/MapLib/Service/RequestScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal sealed class RequestScheduler
// Worker threads
// Mem Cache retrieval has a severe penalty for Queued times and processing when more threads are involved (reason unknown)
// ?? ConcurrentDictionary access ??
private const int NUM_OF_THREAD_TILE = 8;
private const int NUM_OF_THREAD_TILE = 2; // 20230824 Limit to 2 concurrent loading threads (OSM asks for not more than 2..)
private const int NUM_OF_THREAD_CACHE = 4; // Disk Caching may use more..

// the dispatcher
Expand Down
18 changes: 13 additions & 5 deletions FSimMap/MapLib/Sources/Providers/MapProviderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -109,10 +110,10 @@ public static void SetServiceStatus( bool enabled )
static MapProviderBase( )
{
WebProxy = BypassWebProxy.Instance;
Random = new Random( (int)DateTime.Now.Ticks );
UserAgent = string.Format(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:{0}.0) Gecko/20100101 Firefox/{0}.0",
Random.Next( (DateTime.Today.Year - 2012) * 10 - 10, (DateTime.Today.Year - 2012) * 10 ) );
// OSM asks for a legit UserAgent ID - so provide one
FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo( Assembly.GetAssembly( typeof( MapProviderBase ) ).Location );
// will evaluate into "MapLib/m.n.o.p" e.g "MapLib/0.2.0.10" as of writing.
UserAgent = string.Format( $"{fileVersion.ProductName}/{fileVersion.FileVersion}" );

_client.DefaultRequestHeaders.Add( "User-Agent", UserAgent );
_client.DefaultRequestHeaders.Add( "Accept", requestAccept );
Expand Down Expand Up @@ -397,11 +398,18 @@ protected MapImage GetTileImageUsingHttp( string url, MapImageID mapImageID )
var status = ((HttpWebResponse)(ex as WebException).Response).StatusCode;
Debug.WriteLine( $"MapProviderBase.GetTileImageUsingHttp: HttpWebResponse Status: {status} ({(int)status})" );
if ((status == HttpStatusCode.GatewayTimeout) || (status == HttpStatusCode.RequestTimeout)) {
retry = true; // can retry on timeout
retry = true;
}
}
else if ((ex is WebException) && ((int)((HttpWebResponse)(ex as WebException).Response).StatusCode == 418)) {
// seems OSM responds with the teapot code when blocking...
var status = ((HttpWebResponse)(ex as WebException).Response).StatusCode;
Debug.WriteLine( $"MapProviderBase.GetTileImageUsingHttp: HttpWebResponse Status: {status} ({(int)status})" );
retry = false; // never retry
}
else {
Debug.WriteLine( $"MapProviderBase.GetTileImageUsingHttp: Response Exception:\n{ex}\nURL:${url}" );
retry = false; // never retry
}
}

Expand Down
2 changes: 2 additions & 0 deletions ReadMe-FlightBag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ V 0.65-B66
- Update Improve focus capture and release for scrollable items
- Update Uses LVar Get via SimVar framework (Set of such LVars still needs the WASM module)
- Refactoring, complete rework of the DataProvider DLLs
- Update MapLib to comply with OSM tile policy (2 concurrent DL only)
- Update QuickGuide

V 0.64-B64 (not published)
- Refactoring, complete rework of the DataProvider DLLs
Expand Down
2 changes: 2 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ V 0.65-B66
- Update Uses LVar Get via SimVar framework (Set of such LVars still needs the WASM module)
- Update Review and adjust update interval for each item
- Refactoring, complete rework of the DataProvider DLLs
- Update MapLib to comply with OSM tile policy (2 concurrent DL only)
- Update QuickGuide

V 0.64-B64 (not published)
- Refactoring, complete rework of the DataProvider DLLs
Expand Down

0 comments on commit 677dab9

Please sign in to comment.