Skip to content

Commit 62bba95

Browse files
authored
Merge pull request #775 from kinvolk/imran/fix-stale-servercount-update
fix: avoid stale server count update
2 parents f09b419 + 46fe4bb commit 62bba95

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/agent/clientset.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,14 @@ func (cs *ClientSet) connectOnce() (int, error) {
300300
if err != nil {
301301
return serverCount, err
302302
}
303-
cs.lastReceivedServerCount = receivedServerCount
304303
if err := cs.AddClient(c.serverID, c); err != nil {
305304
c.Close()
306305
return serverCount, err
307306
}
307+
// By moving the update to here, we only accept the server count from a server
308+
// that we have successfully added to our active client set, implicitly ignoring
309+
// stale data from duplicate connection attempts.
310+
cs.lastReceivedServerCount = receivedServerCount
308311
klog.V(2).InfoS("sync added client connecting to proxy server", "serverID", c.serverID)
309312

310313
labels := runpprof.Labels(

0 commit comments

Comments
 (0)