diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-11 16:18:20 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-11 16:18:20 +0200 |
commit | a4eff12d7f749c992247579161c4ce9e60e2df47 (patch) | |
tree | 6032dd0a96ced8313d7199e569ab657f3ba91ca7 /src/send.go | |
parent | cba1d6585ab9b12ae3e0897db85675ba452c3f09 (diff) |
Improved receive.go
- Fixed configuration listen-port semantics
- Improved receive.go code for updating listen port
- Updated under load detection, how follows the kernel space implementation
- Fixed trie bug accidentally introduced in last commit
- Added interface name to log (format still subject to change)
- Can now configure the logging level using the LOG_LEVEL variable
- Begin porting netsh.sh tests
- A number of smaller changes
Diffstat (limited to 'src/send.go')
-rw-r--r-- | src/send.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/send.go b/src/send.go index cf1f018..0de3c0a 100644 --- a/src/send.go +++ b/src/send.go @@ -137,10 +137,6 @@ func (peer *Peer) SendBuffer(buffer []byte) (int, error) { */ func (device *Device) RoutineReadFromTUN() { - if device.tun == nil { - return - } - var elem *QueueOutboundElement logDebug := device.log.Debug @@ -155,9 +151,8 @@ func (device *Device) RoutineReadFromTUN() { elem = device.NewOutboundElement() } - // TODO: THIS! elem.packet = elem.buffer[MessageTransportHeaderSize:] - size, err := device.tun.Read(elem.packet) + size, err := device.tun.device.Read(elem.packet) if err != nil { logError.Println("Failed to read packet from TUN device:", err) device.Close() @@ -345,7 +340,7 @@ func (device *Device) RoutineEncryption() { // pad content to MTU size - mtu := int(atomic.LoadInt32(&device.mtu)) + mtu := int(atomic.LoadInt32(&device.tun.mtu)) pad := len(elem.packet) % PaddingMultiple if pad > 0 { for i := 0; i < PaddingMultiple-pad && len(elem.packet) < mtu; i++ { |