Skip to contentSkip to conversation

Patch: initialise device.peers.empty

PATCH Laura Zelenku 2 participants 3 messages Feb 25, 2021

lore
Share & tools
lore
#0 lore raw

Hi devs,
in some custom unit test for wireguard go I’m experiencing failed tests because “device.peers.empty” contains default “false” value right after device creation. Please apply following patch to initialise the value to true (empty = true) in device creation.

thanks
Laura

Index: device/device.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
===================================================================

device.go +1 -0
@@ -292,6 +292,7 @@
 	}
 	device.tun.mtu = int32(mtu)
 	device.peers.keyMap = make(map[NoisePublicKey]*Peer)
+	device.peers.empty.Set(true)
 	device.rate.limiter.Init()
 	device.indexTable.Init()
 	device.PopulatePools()
Signature · 6 lines
*IMPORTANT NOTICE*: This email, its attachments and any rights attaching 
hereto are confidential and intended exclusively for the person to whom the 
email is addressed. If you are not the intended recipient, do not read, 
copy, disclose or use the contents in any way. Wandera accepts no liability 
for any loss, damage or consequence resulting directly or indirectly from 
the use of this email and attachments.
#1 lore raw

Hi Laura,

Thanks for the patch. Can you resubmit this as a proper git-formatted patch containing your Signed-off-by line?

git commit -s --amend --no-edit
git send-email HEAD~

Also, you mentioned custom unit tests. Any of those suitable for sending upstream?

Jason