fixed stalled requests after app resume
This commit is contained in:
@@ -16,6 +16,16 @@ class MarianumConnectApi {
|
||||
|
||||
static Dio dio() => _instance;
|
||||
|
||||
/// Drops the pooled keep-alive sockets. After a suspend the OS or a NAT
|
||||
/// has usually killed them already, but dart:io only notices once a request
|
||||
/// is written into one — which then hangs until [_receiveTimeout].
|
||||
/// In-flight requests finish on the old adapter.
|
||||
static void resetConnections() {
|
||||
final stale = _instance.httpClientAdapter;
|
||||
_instance.httpClientAdapter = HttpClientAdapter();
|
||||
stale.close();
|
||||
}
|
||||
|
||||
/// A fresh dio with the standard JSON options but no interceptors — used by
|
||||
/// the auth queries (login/verify) that must bypass the bearer/demo
|
||||
/// interceptors to avoid a re-auth loop.
|
||||
|
||||
Reference in New Issue
Block a user