Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

EventBus EvtLocalReachabilityChanged emits conflicting measurements #113

Open
acud opened this issue Dec 6, 2021 · 2 comments
Open

EventBus EvtLocalReachabilityChanged emits conflicting measurements #113

acud opened this issue Dec 6, 2021 · 2 comments

Comments

@acud
Copy link

acud commented Dec 6, 2021

Hi all,

We have a background worker that taps onto the events from the autonat service and propagates them to the necessary components, like so:

func (s *Service) reachabilityWorker() error {
	sub, err := s.host.EventBus().Subscribe([]interface{}{new(event.EvtLocalReachabilityChanged)})
	if err != nil {
		return fmt.Errorf("failed subscribing to reachability event %w", err)
	}

	go func() {
		defer sub.Close()
		for {
			select {
			case <-s.ctx.Done():
				return
			case e := <-sub.Out():
				if r, ok := e.(event.EvtLocalReachabilityChanged); ok {
					select {
					case <-s.ready:
					case <-s.halt:
						return
					}
					s.logger.Debugf("reachability changed to %s", r.Reachability.String())
					s.notifier.UpdateReachability(p2p.ReachabilityStatus(r.Reachability))
				}
			}
		}
	}()
	return nil
}

Now, looking at the measurements on a local node (which was behind NAT) I managed to see multiple events constantly being emitted, even after the initial status was emitted. So the node pivots between Private and Public intermittently.

Having looked at the issues in this repo (and from our experience within the team) I know that this issue is not trivial to assume, but in the meanwhile, I'd like to ask if we can rely on this data somehow, and if we could apply some sort of a heuristic on top of this, so that the measurement becomes more credible (assuming we are only dealing with public CIDRs).

Many thanks in advance!

@marten-seemann
Copy link
Contributor

Do you have any idea where the Public measurement is coming from? Is there any address that the node is dialable at?

@acud
Copy link
Author

acud commented Jan 2, 2022

No clue whatsoever @marten-seemann. Would you have an idea on how to actually check that? would I have to check the bind addresses for libp2p then try to telnet from another host?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants