From db16986583057d9258b6b29e15121b6d608d68e1 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 14 Jan 2010 15:53:54 +0000
Subject: [PATCH] confd client: copy the peers in UpdatePeerList

Since the peer list is shuffled by the client, we don't keep a reference
to the list which was passed in, but copy it internally.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/confd/client.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/confd/client.py b/lib/confd/client.py
index e3288683f..dba30ee0b 100644
--- a/lib/confd/client.py
+++ b/lib/confd/client.py
@@ -133,7 +133,8 @@ class ConfdClient:
     # pylint: disable-msg=W0201
     if not isinstance(peers, list):
       raise errors.ProgrammerError("peers must be a list")
-    self._peers = peers
+    # make a copy of peers, since we're going to shuffle the list, later
+    self._peers = list(peers)
 
   def _PackRequest(self, request, now=None):
     """Prepare a request to be sent on the wire.
-- 
GitLab