diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-02 16:40:14 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-02 16:40:14 +0100 |
commit | 029410b118f079d77fa448cf56a97b949faee126 (patch) | |
tree | 5c9ecf509601b3abffe36094b3b228b87b7d8b92 /src/send.go | |
parent | 1e42b1402261d15b87b1b5871f7bc51342b46e34 (diff) | |
download | wireguard-go-029410b118f079d77fa448cf56a97b949faee126.tar.gz wireguard-go-029410b118f079d77fa448cf56a97b949faee126.zip |
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.
Diffstat (limited to 'src/send.go')
-rw-r--r-- | src/send.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/send.go b/src/send.go index e0a546d..7488d3a 100644 --- a/src/send.go +++ b/src/send.go @@ -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 { |