node: rename startNetworking to openEndpoints #22105 (#1130)

This commit is contained in:
JukLee0ira 2025-06-23 14:56:09 +08:00 committed by GitHub
parent 1b0420f19a
commit e351d96e01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -182,12 +182,13 @@ func (n *Node) Start() error {
return ErrNodeStopped
}
n.state = runningState
err := n.startNetworking()
// open networking and RPC endpoints
err := n.openEndpoints()
lifecycles := make([]Lifecycle, len(n.lifecycles))
copy(lifecycles, n.lifecycles)
n.lock.Unlock()
// Check if networking startup failed.
// Check if endpoint startup failed.
if err != nil {
n.doClose(nil)
return err
@ -276,12 +277,14 @@ func (n *Node) doClose(errs []error) error {
}
}
// startNetworking starts all network endpoints.
func (n *Node) startNetworking() error {
// openEndpoints starts all network and RPC endpoints.
func (n *Node) openEndpoints() error {
// start networking endpoints
n.log.Info("Starting peer-to-peer node", "instance", n.server.Name)
if err := n.server.Start(); err != nil {
return convertFileLockError(err)
}
// start RPC endpoints
err := n.startRPC()
if err != nil {
n.stopRPC()