Skip to content

Commit

Permalink
Merge pull request #69 from SiaFoundation/chris/fix-syncer-connect
Browse files Browse the repository at this point in the history
Fix `allowConnect` failing due to port number
  • Loading branch information
n8maninger authored Jul 9, 2024
2 parents 5b6af68 + b87f104 commit 11bcc7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,11 @@ func (s *Syncer) allowConnect(peer string, inbound bool) error {
if s.l == nil {
return errors.New("syncer is shutting down")
}
addrs, err := (&net.Resolver{}).LookupIPAddr(s.shutdownCtx, peer)
if err != nil {

var addrs []net.IPAddr
if peerHost, _, err := net.SplitHostPort(peer); err != nil {
return fmt.Errorf("failed to split peer host and port: %w", err)
} else if addrs, err = (&net.Resolver{}).LookupIPAddr(s.shutdownCtx, peerHost); err != nil {
return fmt.Errorf("failed to resolve peer address: %w", err)
} else if len(addrs) == 0 {
return fmt.Errorf("peer didn't resolve to any addresses")
Expand Down

0 comments on commit 11bcc7b

Please sign in to comment.