lightninglabs / lightning-node-connect

MIT License
79 stars 22 forks source link

Detect expired session #31

Closed guggero closed 2 years ago

guggero commented 2 years ago

A follow-up issue after implementing https://github.com/lightninglabs/lightning-terminal/pull/300.

Currently there is no way for the client to distinguish between LiT not being online vs. a session having expired. The client just tries to re-connect infinitely, even if a "mailbox does not exist" error is returned.

Perhaps we should start looking at the exact errors returned by the mailbox proxy and add a counter for some of them and abort after a certain number of retries. Then we could present the user with an error message, something like "server did not create mailbox; session not started or expired".

ellemouton commented 2 years ago

another thing we can also report back is "session already in use" meaning that the user probably has another tab open that they have forgotten about.

ellemouton commented 2 years ago

as for expiry, this is slightly tricker and I think needs to be handled in the layer above lnc (ie, in TW). Cause there we can get the macaroon on first connection and glean the expiry there using the OnAuthData call back

ellemouton commented 2 years ago

closed by https://github.com/lightninglabs/lightning-node-connect/pull/41 and https://github.com/lightninglabs/lightning-node-connect/pull/44