mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-16 04:39:16 +00:00
Abort assimilation attempt on non-member cleanly
If a confluent instance has forgotten the collective, more cleanly handle the situation, and abort the assimilation rather than assuming the peer should be leader, unless txcount specifically is called out as the reason.
This commit is contained in:
parent
9e8b2dd973
commit
247650868e
@ -322,6 +322,11 @@ def handle_connection(connection, cert, request, local=False):
|
||||
if 'assimilate' == operation:
|
||||
drone = request['name']
|
||||
droneinfo = cfm.get_collective_member(drone)
|
||||
if not droneinfo:
|
||||
tlvdata.send(connection,
|
||||
{'error': 'Unrecognized leader, '
|
||||
'redo invitation process'})
|
||||
return
|
||||
if not util.cert_matches(droneinfo['fingerprint'], cert):
|
||||
tlvdata.send(connection,
|
||||
{'error': 'Invalid certificate, '
|
||||
@ -432,7 +437,7 @@ def try_assimilate(drone):
|
||||
tlvdata.recv(remote) # the banner
|
||||
tlvdata.recv(remote) # authpassed... 0..
|
||||
answer = tlvdata.recv(remote)
|
||||
if answer and 'error' in answer:
|
||||
if answer and 'txcount' in answer:
|
||||
connect_to_leader(None, None, leader=remote.getpeername()[0])
|
||||
|
||||
def get_leader(connection):
|
||||
|
Loading…
x
Reference in New Issue
Block a user