make Dial block until the search finishes, and use it as such

This commit is contained in:
Arceliar 2019-06-28 18:42:31 -05:00
parent 29a0f8b572
commit 5df110ac79
5 changed files with 111 additions and 156 deletions

View file

@ -49,6 +49,7 @@ type TunAdapter struct {
mutex sync.RWMutex // Protects the below
addrToConn map[address.Address]*tunConn
subnetToConn map[address.Subnet]*tunConn
dials map[crypto.NodeID][][]byte // Buffer of packets to send after dialing finishes
isOpen bool
}
@ -113,6 +114,7 @@ func (tun *TunAdapter) Init(config *config.NodeState, log *log.Logger, listener
tun.dialer = dialer
tun.addrToConn = make(map[address.Address]*tunConn)
tun.subnetToConn = make(map[address.Subnet]*tunConn)
tun.dials = make(map[crypto.NodeID][][]byte)
}
// Start the setup process for the TUN/TAP adapter. If successful, starts the