Page MenuHomePhabricator

D13787.diff
No OneTemporary

D13787.diff

diff --git a/lib/tunnelbroker/tunnelbroker-context.js b/lib/tunnelbroker/tunnelbroker-context.js
--- a/lib/tunnelbroker/tunnelbroker-context.js
+++ b/lib/tunnelbroker/tunnelbroker-context.js
@@ -110,6 +110,9 @@
const accessToken = useSelector(state => state.commServicesAccessToken);
const userID = useSelector(state => state.currentUserInfo?.id);
+ const isAppActive = useSelector(
+ state => state.lifecycleState !== 'background',
+ );
const [unauthorizedDeviceID, setUnauthorizedDeviceID] =
React.useState<?string>(null);
@@ -440,6 +443,12 @@
[secondaryTunnelbrokerConnection],
);
+ React.useEffect(() => {
+ if (!isAppActive) {
+ socket.current?.close();
+ }
+ }, [isAppActive]);
+
const addListener = React.useCallback(
(listener: TunnelbrokerSocketListener) => {
listeners.current.add(listener);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 4:48 AM (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573996
Default Alt Text
D13787.diff (864 B)

Event Timeline