• Vincent Pelletier's avatar
    Exit election as soon as primary master is known. · 81ee387a
    Vincent Pelletier authored
    It has no meaning to stay in election state when the primary master is
    known. Also, it causes problems as the elected primary master will soon
    start sending packets we don't expect while election is running.
    
    handler/election.py:
    - Receiving announcePrimary is enough to exit election immediately, so
      reach election end condition (both sets must be empty)
    - Receiving answerPrimary with a known primary is enough to exit election
      immediately (don't attempt to connect to to primary master).
    app.py:
    - Apply PrimaryHandler while iterating over connections when the primary
      master connection is found, rather than once all other connections are
      closed.
    - If no primary master connection was found, start establishing one.
    handlers/secondary.py:
    - Handle connectionCompleted event as we might only reach primary master
      once with this handler if connection was not established during election.
    - Likewise, handle connectionFailed event, and treat it as a primary
      failure.
    - Stop ignoring answerPrimary packets, instead check that advertised
      primary master is the expected one and request node identification.
    
    git-svn-id: https://svn.erp5.org/repos/neo/trunk@1583 71dcc9de-d417-0410-9af5-da40c76e7ee4
    81ee387a
election.py 10.4 KB