forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
networking: Fix requests failing when turning network off and on face…
…book#19709. This bug is probably actually a bug in OkHttp: square/okhttp#4079 Both issues linked above contain extensive details about the issue, its likely origins and how to reproduce it. A short summary of the issue and the fix in this commit: On Android, disconnecting from the network somehow corrupts the idle connections and ongoing calls in okhttp clients. New requests made over these clients fail. This commit works around that bug by evicting the idle connection pool when we receive a DISCONNECTED or CONNECTING event (we don't know yet if only one or both of them cause the issue). Technically, to fully fix this issue, we would also need to cancel all ongoing calls. However, cancelling all ongoing calls is aggressive, and not always desired (when the app disconnects only for a short time, ongoing calls might still succeed). In practice, just evicting idle connections results in this issue occurring less often, so let's go with that for now.
- Loading branch information
1 parent
370bcff
commit aa2e00a
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters