From e3d52674855d0742646446b30f631ed59255de7a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 29 Nov 2024 18:21:41 +0200 Subject: [PATCH] bridgev2/networkinterface: don't allow returning errors in Connect --- bridgev2/bridge.go | 5 +---- bridgev2/networkinterface.go | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bridgev2/bridge.go b/bridgev2/bridge.go index 16ebdb77..b2151ee6 100644 --- a/bridgev2/bridge.go +++ b/bridgev2/bridge.go @@ -187,10 +187,7 @@ func (br *Bridge) StartLogins() error { for _, login := range user.GetUserLogins() { startedAny = true br.Log.Info().Str("id", string(login.ID)).Msg("Starting user login") - err = login.Client.Connect(login.Log.WithContext(ctx)) - if err != nil { - br.Log.Err(err).Msg("Failed to connect existing client") - } + login.Client.Connect(login.Log.WithContext(ctx)) } } } diff --git a/bridgev2/networkinterface.go b/bridgev2/networkinterface.go index 6e31e721..9acc6eae 100644 --- a/bridgev2/networkinterface.go +++ b/bridgev2/networkinterface.go @@ -344,7 +344,9 @@ type NetworkRoomCapabilities struct { type NetworkAPI interface { // Connect is called to actually connect to the remote network. // If there's no persistent connection, this may just check access token validity, or even do nothing at all. - Connect(ctx context.Context) error + // This method isn't allowed to return errors, because any connection errors should be sent + // using the bridge state mechanism (UserLogin.BridgeState.Send) + Connect(ctx context.Context) // Disconnect should disconnect from the remote network. // A clean disconnection is preferred, but it should not take too long. Disconnect()