[client] Init route selector early (#2989)

This commit is contained in:
Viktor Liu 2024-12-05 12:41:12 +01:00 committed by GitHub
parent c853011a32
commit 6cfbb1f320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,6 +124,8 @@ func NewManager(
// Init sets up the routing
func (m *DefaultManager) Init() (nbnet.AddHookFunc, nbnet.RemoveHookFunc, error) {
m.routeSelector = m.initSelector()
if nbnet.CustomRoutingDisabled() {
return nil, nil, nil
}
@ -144,8 +146,6 @@ func (m *DefaultManager) Init() (nbnet.AddHookFunc, nbnet.RemoveHookFunc, error)
return nil, nil, fmt.Errorf("setup routing: %w", err)
}
m.routeSelector = m.initSelector()
log.Info("Routing setup complete")
return beforePeerHook, afterPeerHook, nil
}