5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 17:41:36 +00:00

Don't write huge mostly empty buffers unnecessarily

This commit is contained in:
Neil Alexander 2019-04-22 11:22:40 +01:00
parent 47eb2fc47f
commit ccf03fd3b6
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -263,7 +263,7 @@ func (tun *TunAdapter) ifaceReader() error {
tun.mutex.Lock()
if conn, isIn := tun.conns[*dstNodeID]; isIn {
tun.mutex.Unlock()
w, err := conn.Write(bs)
w, err := conn.Write(bs[:n])
if err != nil {
tun.log.Errorln("TUN/TAP conn write error:", err)
continue