5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-19 00:59:37 +00:00

Merge pull request #842 from Arceliar/mutex

Fix incorrect mutex use in ipv6rwc
This commit is contained in:
Arceliar 2021-09-24 04:43:44 -05:00 committed by GitHub
commit 6af9b61b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,4 @@
//go:build debug
// +build debug
package core

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin
package core

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package core

View File

@ -1,3 +1,4 @@
//go:build !darwin && !linux
// +build !darwin,!linux
package core

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin
package defaults

View File

@ -1,3 +1,4 @@
//go:build freebsd
// +build freebsd
package defaults

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package defaults

View File

@ -1,3 +1,4 @@
//go:build openbsd
// +build openbsd
package defaults

View File

@ -1,3 +1,4 @@
//go:build !linux && !darwin && !windows && !openbsd && !freebsd
// +build !linux,!darwin,!windows,!openbsd,!freebsd
package defaults

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package defaults

View File

@ -132,6 +132,7 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo {
var kArray keyArray
copy(kArray[:], key)
var info *keyInfo
var packets [][]byte
if info = k.keyToInfo[kArray]; info == nil {
info = new(keyInfo)
info.key = kArray
@ -140,19 +141,19 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo {
k.keyToInfo[info.key] = info
k.addrToInfo[info.address] = info
k.subnetToInfo[info.subnet] = info
k.resetTimeout(info)
k.mutex.Unlock()
if buf := k.addrBuffer[info.address]; buf != nil {
k.core.WriteTo(buf.packet, iwt.Addr(info.key[:]))
packets = append(packets, buf.packet)
delete(k.addrBuffer, info.address)
}
if buf := k.subnetBuffer[info.subnet]; buf != nil {
k.core.WriteTo(buf.packet, iwt.Addr(info.key[:]))
packets = append(packets, buf.packet)
delete(k.subnetBuffer, info.subnet)
}
} else {
k.resetTimeout(info)
k.mutex.Unlock()
}
k.resetTimeout(info)
k.mutex.Unlock()
for _, packet := range packets {
k.core.WriteTo(packet, iwt.Addr(info.key[:]))
}
return info
}

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin
package multicast

View File

@ -1,3 +1,4 @@
//go:build !linux && !darwin && !netbsd && !freebsd && !openbsd && !dragonflybsd && !windows
// +build !linux,!darwin,!netbsd,!freebsd,!openbsd,!dragonflybsd,!windows
package multicast

View File

@ -1,3 +1,4 @@
//go:build linux || netbsd || freebsd || openbsd || dragonflybsd
// +build linux netbsd freebsd openbsd dragonflybsd
package multicast

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package multicast

View File

@ -1,3 +1,4 @@
//go:build openbsd || freebsd
// +build openbsd freebsd
package tuntap

View File

@ -1,3 +1,4 @@
//go:build !mobile
// +build !mobile
package tuntap

View File

@ -1,3 +1,4 @@
//go:build !mobile
// +build !mobile
package tuntap

View File

@ -1,3 +1,4 @@
//go:build !linux && !darwin && !windows && !openbsd && !freebsd && !mobile
// +build !linux,!darwin,!windows,!openbsd,!freebsd,!mobile
package tuntap

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package tuntap