mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: stop spamming DERP map updates for equivalent maps (#11792)
Fixes 2 related issues: 1. wsconncache had incorrect logic to test whether to send DERPMap updates, sending if the maps were equivalent, instead of if they were _not equivalent_. 2. configmaps used a bugged check to test equality between DERPMaps, since it contains a map and the map entries are serialized in random order. Instead, we avoid comparing the protobufs and instead depend on the existing function that compares `tailcfg.DERPMap`. This also has the effect of reducing the number of times we convert to and from protobuf.
This commit is contained in:
+2
-2
@@ -218,7 +218,7 @@ func NewConn(options *Options) (conn *Conn, err error) {
|
||||
magicConn.DiscoPublicKey(),
|
||||
)
|
||||
cfgMaps.setAddresses(options.Addresses)
|
||||
cfgMaps.setDERPMap(DERPMapToProto(options.DERPMap))
|
||||
cfgMaps.setDERPMap(options.DERPMap)
|
||||
cfgMaps.setBlockEndpoints(options.BlockEndpoints)
|
||||
|
||||
nodeUp := newNodeUpdater(
|
||||
@@ -326,7 +326,7 @@ func (c *Conn) SetNodeCallback(callback func(node *Node)) {
|
||||
|
||||
// SetDERPMap updates the DERPMap of a connection.
|
||||
func (c *Conn) SetDERPMap(derpMap *tailcfg.DERPMap) {
|
||||
c.configMaps.setDERPMap(DERPMapToProto(derpMap))
|
||||
c.configMaps.setDERPMap(derpMap)
|
||||
}
|
||||
|
||||
func (c *Conn) SetDERPForceWebSockets(v bool) {
|
||||
|
||||
Reference in New Issue
Block a user