From abbe94fa8085aefd4d9ce8962cd9fcba5d84b445 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 26 Mar 2023 16:34:49 -0500 Subject: [PATCH] fix core tests and run gofmt on src --- src/core/core_test.go | 7 ++++++- src/ipv6rwc/ipv6rwc.go | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/core/core_test.go b/src/core/core_test.go index 8d57f336..669ed172 100644 --- a/src/core/core_test.go +++ b/src/core/core_test.go @@ -70,7 +70,12 @@ func WaitConnected(nodeA, nodeB *Core) bool { // It may take up to 3 seconds, but let's wait 5. for i := 0; i < 50; i++ { time.Sleep(100 * time.Millisecond) - if len(nodeA.GetPeers()) > 0 && len(nodeB.GetPeers()) > 0 { + /* + if len(nodeA.GetPeers()) > 0 && len(nodeB.GetPeers()) > 0 { + return true + } + */ + if len(nodeA.GetPaths()) > 1 && len(nodeB.GetPaths()) > 1 { return true } } diff --git a/src/ipv6rwc/ipv6rwc.go b/src/ipv6rwc/ipv6rwc.go index fe92910c..22213c5f 100644 --- a/src/ipv6rwc/ipv6rwc.go +++ b/src/ipv6rwc/ipv6rwc.go @@ -31,16 +31,16 @@ const ( type keyArray [ed25519.PublicKeySize]byte type keyStore struct { - core *core.Core - address address.Address - subnet address.Subnet - mutex sync.Mutex - keyToInfo map[keyArray]*keyInfo - addrToInfo map[address.Address]*keyInfo + core *core.Core + address address.Address + subnet address.Subnet + mutex sync.Mutex + keyToInfo map[keyArray]*keyInfo + addrToInfo map[address.Address]*keyInfo //addrBuffer map[address.Address]*buffer subnetToInfo map[address.Subnet]*keyInfo //subnetBuffer map[address.Subnet]*buffer - mtu uint64 + mtu uint64 } type keyInfo struct { @@ -162,14 +162,14 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo { k.addrToInfo[info.address] = info k.subnetToInfo[info.subnet] = info /* - if buf := k.addrBuffer[info.address]; buf != nil { - packets = append(packets, buf.packet) - delete(k.addrBuffer, info.address) - } - if buf := k.subnetBuffer[info.subnet]; buf != nil { - packets = append(packets, buf.packet) - delete(k.subnetBuffer, info.subnet) - } + if buf := k.addrBuffer[info.address]; buf != nil { + packets = append(packets, buf.packet) + delete(k.addrBuffer, info.address) + } + if buf := k.subnetBuffer[info.subnet]; buf != nil { + packets = append(packets, buf.packet) + delete(k.subnetBuffer, info.subnet) + } */ } k.resetTimeout(info)