derp: fix tracking problem if conn starts local, then also joins mesh peer

This commit is contained in:
Brad Fitzpatrick
2020-06-05 12:47:23 -07:00
parent 39f2fe29f7
commit 07ca0c1c29
2 changed files with 29 additions and 8 deletions

View File

@ -732,4 +732,17 @@ func TestForwarderRegistration(t *testing.T) {
want(map[key.Public]PacketForwarder{
u1: testFwd(2),
})
// Now pretend u1 was already connected locally (so clientsMesh[u1] is nil), and then we heard
// that they're also connected to a peer of ours. That sholdn't transition the forwarder
// from nil to the new one, not a multiForwarder.
s.clients[u1] = u1c
s.clientsMesh[u1] = nil
want(map[key.Public]PacketForwarder{
u1: nil,
})
s.AddPacketForwarder(u1, testFwd(3))
want(map[key.Public]PacketForwarder{
u1: testFwd(3),
})
}