Notify ReactorError before (not after) throwing exception on pending APIs

This commit is contained in:
Wizou 2022-07-24 15:03:13 +02:00
parent 000c35b256
commit 5743942a7f
2 changed files with 3 additions and 2 deletions

3
FAQ.md
View file

@ -191,7 +191,8 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is
This should be transparent and pending API calls should automatically be resent upon reconnection. This should be transparent and pending API calls should automatically be resent upon reconnection.
You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable. You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable.
3) If you reach `MaxAutoReconnects` disconnections, then the **Update** event handler will receive a `ReactorError` object to notify you of the problem. 3) If you reach `MaxAutoReconnects` disconnections, then the **Update** event handler will receive a `ReactorError` object to notify you of the problem,
and pending API calls throw the network IOException.
In this case, the recommended action would be to dispose the client and recreate one In this case, the recommended action would be to dispose the client and recreate one
4) In case of slow Internet connection or if you break in the debugger for some time, 4) In case of slow Internet connection or if you break in the debugger for some time,

View file

@ -329,6 +329,7 @@ namespace WTelegram
} }
catch catch
{ {
OnUpdate(reactorError);
lock (_pendingRpcs) // abort all pending requests lock (_pendingRpcs) // abort all pending requests
{ {
foreach (var rpc in _pendingRpcs.Values) foreach (var rpc in _pendingRpcs.Values)
@ -336,7 +337,6 @@ namespace WTelegram
_pendingRpcs.Clear(); _pendingRpcs.Clear();
_bareRpc = null; _bareRpc = null;
} }
OnUpdate(reactorError);
} }
finally finally
{ {