• Levin Zimmermann's avatar
    identification: Set possible answers to same msgid · b7da3220
    Levin Zimmermann authored
    When a node tries to connect to another node it initially sends a
    'RequestIdentification' packet. The other node can either reply with
    'AcceptIdentification' or in case of a secondary master with
    'NotPrimaryMaster'.
    
    In the second case the message id differs from the initial requests
    message id. This makes it difficult in a multi-threaded implementation
    to proceed this answer: due to the different msg/connection - id the
    multi-threaded implementation tries to proceed this incoming message in
    a different thread, while the requesting thread waits forever for its
    peers reply.
    
    The most straightforward solution is to use the same connection - id for
    both possible answers to the 'RequestIdentification' packet. This
    doesn't break given NEO/py implementation and is only a small patch.
    A workaround in a multi-threaded implementation on the other hand
    seems to be much more complicated and time-consuming. Finally it also makes
    sense semantically, because "Message IDs are used to identify response
    packets" and in the given context the 'NotPrimaryMaster' *is* the de facto
    response of a 'RequestIdentification'.
    b7da3220
identification.py 6.56 KB