Skip to content

Commit

Permalink
chore: golines (#295)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 authored Dec 22, 2024
1 parent aae174a commit 2634e8a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion connmanager/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"go.opentelemetry.io/otel/attribute"
)

func (c *ConnectionManager) CreateOutboundConn(address string) (*ouroboros.Connection, error) {
func (c *ConnectionManager) CreateOutboundConn(
address string,
) (*ouroboros.Connection, error) {
t := otel.Tracer("")
if t != nil {
_, span := t.Start(context.TODO(), "create outbound connection")
Expand Down
16 changes: 13 additions & 3 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ func (n *Node) Run() error {
ConnManager: n.connManager,
},
)
n.eventBus.SubscribeFunc(peergov.OutboundConnectionEventType, n.handleOutboundConnEvent)
n.eventBus.SubscribeFunc(
peergov.OutboundConnectionEventType,
n.handleOutboundConnEvent,
)
if n.config.topologyConfig != nil {
n.peerGov.LoadTopologyConfig(n.config.topologyConfig)
}
Expand Down Expand Up @@ -231,7 +234,10 @@ func (n *Node) configureConnManager() error {
},
)
// Subscribe to connection closed events
n.eventBus.SubscribeFunc(connmanager.ConnectionClosedEventType, n.handleConnClosedEvent)
n.eventBus.SubscribeFunc(
connmanager.ConnectionClosedEventType,
n.handleConnClosedEvent,
)
// Start listeners
if err := n.connManager.Start(); err != nil {
return err
Expand Down Expand Up @@ -260,7 +266,11 @@ func (n *Node) handleOutboundConnEvent(evt event.Event) {
chainsyncClientConnId := n.chainsyncState.GetClientConnId()
if chainsyncClientConnId == nil {
if err := n.chainsyncClientStart(connId); err != nil {
n.config.logger.Error("failed to start chainsync client", "error", err)
n.config.logger.Error(
"failed to start chainsync client",
"error",
err,
)
return
}
n.chainsyncState.SetClientConnId(connId)
Expand Down
10 changes: 8 additions & 2 deletions peergov/peergov.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ func NewPeerGovernor(cfg PeerGovernorConfig) *PeerGovernor {

func (p *PeerGovernor) Start() error {
// Setup connmanager event listeners
p.config.EventBus.SubscribeFunc(connmanager.InboundConnectionEventType, p.handleInboundConnectionEvent)
p.config.EventBus.SubscribeFunc(connmanager.ConnectionClosedEventType, p.handleConnectionClosedEvent)
p.config.EventBus.SubscribeFunc(
connmanager.InboundConnectionEventType,
p.handleInboundConnectionEvent,
)
p.config.EventBus.SubscribeFunc(
connmanager.ConnectionClosedEventType,
p.handleConnectionClosedEvent,
)
// Start outbound connections
p.startOutboundConnections()
return nil
Expand Down

0 comments on commit 2634e8a

Please sign in to comment.