handle_check_gid


Description:

public void handle_check_gid (int level)

A node which wants to rest assured that its GID at level lvl is valid will launch handle_check_gid. This
will start operations (if not already in progress) and make sure that for a certain time
from now the check will be periodically sent in broadcast until a response (ok or rehook)
is received or the time expires.
Note that handle_check_gid is not a microfunc and when it returns we can immediately add an id to its answer_queue.
When a node receives such a request and it is in the same gnode, it will launch handle_check_gid. Then it adds
the received request_id to the answer_queue for the level.
To formulate the request to be sent, a node generates a request_id. It will use this request_id in all messages
sent until response/expiration.
When a response is received that is for us and is ok, the same answer is sent again in broadcast to all the id
that we have in answer_queue.
When a response is received that is for us and is rehook, the maproute emits a signal that will cause the
ntkd_node to start a rehook. The signal contains all data needed to reply the same answer after the rehook has
been completed. The reply will occurr only after the node has is_mature, because, until then, the node will not
be able to serve a hook request.
The exact sequence of operations when ntkd_node detects the signal is:
| . (assert the splitted was a primary_address)
| . start rehook from primary_address to [answering_nip]
| . tc=TimeCapsule(xx)
| . while True:
| . if tc.expired(): break
| . if rehook failed: break
| . if addresses.primary_address.is_mature:
| . for queued_id in queue:
| . broadcast_client.maproute.answer_gid( \
| . addresses.primary_address.maproute.me, \
| . queued_id, \
| . actual_gid)
| . break
| . swait a bit
| So, the data needed with the signal 'GNODE_SPLITTED' are: (neighbours=[answering_nip], queue, actual_gid)
|Note_1: An address_manager nom-autonomous will ignore messages request_gid.
|Note_2: An address_manager nom-autonomous that detects a possible gnode split will start handle_check_gid, but if
| it receives a rehook then it just dies. (this check is in ntkd_node)
|Note_3: An address_manager that has not is_mature will ignore messages request_gid.