Rework of entire locking system
Locking on the Device instance is now much more fined-grained, seperating out the fields into "resources" st. most common interactions only require a small number.
This commit is contained in:
parent
1e42b14022
commit
029410b118
10 changed files with 386 additions and 239 deletions
|
|
@ -151,14 +151,14 @@ func (device *Device) RoutineReadFromTUN() {
|
|||
continue
|
||||
}
|
||||
dst := elem.packet[IPv4offsetDst : IPv4offsetDst+net.IPv4len]
|
||||
peer = device.routingTable.LookupIPv4(dst)
|
||||
peer = device.routing.table.LookupIPv4(dst)
|
||||
|
||||
case ipv6.Version:
|
||||
if len(elem.packet) < ipv6.HeaderLen {
|
||||
continue
|
||||
}
|
||||
dst := elem.packet[IPv6offsetDst : IPv6offsetDst+net.IPv6len]
|
||||
peer = device.routingTable.LookupIPv6(dst)
|
||||
peer = device.routing.table.LookupIPv6(dst)
|
||||
|
||||
default:
|
||||
logDebug.Println("Received packet with unknown IP version")
|
||||
|
|
@ -187,10 +187,14 @@ func (device *Device) RoutineReadFromTUN() {
|
|||
func (peer *Peer) RoutineNonce() {
|
||||
var keyPair *KeyPair
|
||||
|
||||
defer peer.routines.stopping.Done()
|
||||
|
||||
device := peer.device
|
||||
logDebug := device.log.Debug
|
||||
logDebug.Println("Routine, nonce worker, started for peer", peer.String())
|
||||
|
||||
peer.routines.starting.Done()
|
||||
|
||||
for {
|
||||
NextPacket:
|
||||
select {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue