Skip to content
  • YACOVM's avatar
    [FAB-3109] Fix anchor peer connection logic · f966c8c9
    YACOVM authored
    
    
    The current implementation of what happens when the peer connects
    to an anchor peer has a flawed logic.
    
    It assumes that if the probe is successful, the sending is also.
    That's too optimistic.
    Another problem is that after the handshake is performed, the remote peer
    may not distinguish between the closing of the connection of the handshake
    and the closing of the new connection that sends the MembershipRequest,
    since we only support 1 connection between each peer (to prevent DOS).
    
    I re-implemented the logic to do the following:
    1) First, perform a handshake to know whether the remote peer is from
      our org or not.
      Peers in different orgs should not know of our internal endpoints).
      The handshake is performed until it succeeds or too many attempts
      are made.
    2) Now, construct a MembershipRequest and send it until you get
       acked from the remote peer, or when attempts are exhausted.
    
    Added a test that simulates the flow.
    
    Change-Id: I72370d9be816105fdc5af7577ce578faf6e5abdc
    Signed-off-by: default avatarYacov Manevich <yacovm@il.ibm.com>
    f966c8c9