Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3352151
D13787.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
864 B
Referenced Files
None
Subscribers
None
D13787.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13787: [lib] Close tunnelbroker socket when app is in background
Attached
Detach File
Event Timeline
Log In to Comment