From 97f932b9469df5f2afdf723e6a7decc6f3bf382a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 26 Jun 2018 15:29:51 -0400 Subject: [PATCH] Fix the attempt to assimilate In the wake of leader loss, the assimilate attempt was causing one of a couple of bad behaviors, a trace if broken and if it should work, the format of the data payload was incorrect. --- confluent_server/confluent/collective/manager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index f520c60d..19a817c6 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -263,8 +263,15 @@ def handle_connection(connection, cert, request, local=False): # He needs to bootstrap his configuration and subscribe it to updates def try_assimilate(drone): - remote = connect_to_collective(None, drone) - tlvdata.send(remote, {'operation': 'assimilate', 'name': get_myname(), 'txcount': cfm._txcount}) + try: + remote = connect_to_collective(None, drone) + except socket.error: + # Oh well, unable to connect, hopefully the rest will be + # in order + return + tlvdata.send(remote, {'collective': {'operation': 'assimilate', + 'name': get_myname(), + 'txcount': cfm._txcount}}) answer = tlvdata.recv(remote) if 'error' in answer: connect_to_leader(None, None, leader=remote.getpeername()[0])