-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
3a2e78b
to
7e47996
Compare
* Limits the number of dial errors we keep * Exposes the dial errors * Avoids string formatting unless we actually need to. Helps address #119
7e47996
to
755d063
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question.
|
||
// TransportError is the error returned when dialing a specific address. | ||
type TransportError struct { | ||
Address ma.Multiaddr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to save the string
representation of the multiaddr to avoid dereferencing and the interface cost? We're likely going to String()
the maddr for logging anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not. The cost of actually formatting the multiaddr will be higher and, hopefully, we'll only do that once anyways.
Really, we should avoid formatting any of this unless debug logging is enabled but that's going to involve ripping out or fixing our current logging framework.
connC, dialErr := s.dialAddrs(ctx, p, goodAddrsChan) | ||
if dialErr != nil { | ||
logdial["error"] = dialErr.Cause.Error() | ||
if dialErr.Cause == context.Canceled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug introduced by the multierror patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fancy!
connC, dialErr := s.dialAddrs(ctx, p, goodAddrsChan) | ||
if dialErr != nil { | ||
logdial["error"] = dialErr.Cause.Error() | ||
if dialErr.Cause == context.Canceled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
Helps address #119
Alternative to: #120