Skip to content

Commit

Permalink
fix(tcp-control): Use managed proto.IP instead of net.IP
Browse files Browse the repository at this point in the history
  • Loading branch information
heyvito committed Dec 9, 2023
1 parent 1788230 commit f92b773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/wire/tcp_control_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type TCPControlServer interface {
Shutdown()

// Dial opens a new socket to a remote control server specified by addr
Dial(addr net.IP, port uint16) (TCPControlClient, error)
Dial(addr proto.IP, port uint16) (TCPControlClient, error)
}

// TCPControlServerDelegate implements methods that allow handling of incoming
Expand All @@ -39,9 +39,9 @@ type tcpControlServer struct {
network string
}

func (t *tcpControlServer) Dial(addr net.IP, port uint16) (TCPControlClient, error) {
func (t *tcpControlServer) Dial(addr proto.IP, port uint16) (TCPControlClient, error) {
var strAddr string
if v4 := addr.To4(); v4 != nil {
if addr.AddressKind == proto.AddressIPv4 {
strAddr = fmt.Sprintf("%s:%d", addr, port)
} else {
strAddr = fmt.Sprintf("[%s]:%d", addr, port)
Expand Down
2 changes: 1 addition & 1 deletion swim_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (s *swimServer) DispatchTCPPacket(_ core.SyncManager, msg proto.Message, cl
}

func (s *swimServer) EstablishTCP(_ core.SyncManager, node proto.Node) (wire.TCPControlClient, error) {
return s.tcpControl.Dial(node.Address.Bytes(), s.opts.SWIMPort)
return s.tcpControl.Dial(node.Address, s.opts.SWIMPort)
}

func (s *swimServer) AllKnownNodes(core.SyncManager) []proto.Node {
Expand Down

0 comments on commit f92b773

Please sign in to comment.