Skip to content

Commit

Permalink
fix allowConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Jul 9, 2024
1 parent 5b6af68 commit b87f104
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 b87f104

Please sign in to comment.