• Felix Lange's avatar
    p2p/nat: fix concurrent access to autodisc Interface · 983f5a71
    Felix Lange authored
    Concurrent calls to Interface methods on autodisc could return a "not
    discovered" error if the discovery did not finish before the call.
    autodisc.wait expected the done channel to carry the found Interface
    but it was closed instead.
    
    The fix is to use sync.Once for now, which is easier to get right.
    And there is a test. Finally.
    
    This will have to change again when we introduce re-discovery.
    983f5a71
nat_test.go 1.07 KB