Commit 245f1285 authored by Olav Morken's avatar Olav Morken

neighbors: Fix race condition on new address

When a new address is detected, both routers attempt to register it at
the same time. This leads to a race condition where both nodes attempt
to write to the same key at the same time.

There was already a fix for this in the code, but it used the wrong
exception. This patch updates the code to use the correct exception.
parent 17fa3080
......@@ -38,7 +38,7 @@ def add_pair(etcd_client, mac, ipaddress, addrtype):
mac = mac.lower()
etcd_client.write(etcd_key(mac, addrtype), ipaddress, prevExist=False)
except etcd.EtcdKeyNotFound: # Key exists
except etcd.EtcdAlreadyExist: # Key exists
remote_addr =, addrtype), consistent=True).value
if remote_addr != ipaddress:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment