Commit 0f8c285
committed
networking: Fix requests failing when turning network off and on facebook#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 and cancelling all ongoing calls of each client
when we receive a DISCONNECTED or CONNECTING event (we don't know yet if only one or both of
them cause the issue).
Cancelling all calls is aggressive, but when a device disconnects any ongoing calls can fail
anyway, so an app has to expect this scenario.1 parent 370bcff commit 0f8c285
File tree
2 files changed
+66
-1
lines changed- ReactAndroid/src/main/java/com/facebook/react
- modules/network
2 files changed
+66
-1
lines changedLines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
| |||
Lines changed: 58 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
| 21 | + | |
| 22 | + | |
13 | 23 | | |
14 | 24 | | |
| 25 | + | |
15 | 26 | | |
| 27 | + | |
| 28 | + | |
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
| |||
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
43 | 59 | | |
44 | 60 | | |
45 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
46 | 95 | | |
47 | 96 | | |
48 | 97 | | |
| |||
54 | 103 | | |
55 | 104 | | |
56 | 105 | | |
57 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
58 | 111 | | |
59 | 112 | | |
60 | 113 | | |
| |||
68 | 121 | | |
69 | 122 | | |
70 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
71 | 128 | | |
72 | 129 | | |
73 | 130 | | |
| |||
0 commit comments