Page MenuHomePhabricator

[lib] Retry Tunnelbroker connection after closing
ClosedPublic

Authored by bartek on Sep 18 2024, 6:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 9:39 AM
Unknown Object (File)
Fri, Nov 1, 9:38 AM
Unknown Object (File)
Fri, Nov 1, 9:38 AM
Unknown Object (File)
Fri, Nov 1, 9:38 AM
Unknown Object (File)
Fri, Nov 1, 9:37 AM
Unknown Object (File)
Fri, Nov 1, 9:14 AM
Unknown Object (File)
Tue, Oct 22, 10:41 AM
Unknown Object (File)
Tue, Oct 22, 10:21 AM
Subscribers

Details

Summary

Details in ENG-9246.
Added a retry counter variable and a timeout.

  • The effect hook has dependency on this variable
  • It is increased after each retry
  • Retry has to have interval to avoid infinite effect loop. Defaulted to 5s

Previously, effect wasn't triggered if socketState.connected was already false. Change false -> false doesn't trigger the hook, so socket wasn't recreated.

Test Plan
  • On native: Turned airplane mode on/off.
  • On web: turned wifi on/off.

Observed console logs. The connection was successfully restored after network coming back.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Sep 18 2024, 7:59 AM
lib/tunnelbroker/tunnelbroker-context.js
293–296 ↗(On Diff #44315)

Actually should be 0, we don't retry here

kamil added inline comments.
lib/tunnelbroker/tunnelbroker-context.js
91 ↗(On Diff #44315)

I am thinking about less time here, e.g. for the keyserver we have export const clientKeyserverSocketReconnectDelay = 2000; but not sure

This revision is now accepted and ready to land.Sep 18 2024, 9:59 AM
lib/tunnelbroker/tunnelbroker-context.js
91 ↗(On Diff #44315)

Reflecting keyserver makes sense, I'll change to 2000