caeron

why function aeron_driver_context_bindings_clientd_create_entries is invoked twice during the aeronmd init process?


During the aeronmd's main process of aeron-driver in c code, function aeron_driver_context_bindings_clientd_create_entries is invoked twice, one in aeron_driver_context_init and another in aeron_driver_init. Is that a duplication? or there are some reasons for the design consideration?


Solution

  • This method does two things, it allocates space for bindings and it allocates space for interceptors. There are some bindings that need the space earlier in the initialisation phase, so we pre-create some space up front. However, it is still possible to add interceptors after the context has initialised, therefore we need to double check that there is space in the list available for those as well.

    There is probably a refactoring to separate out the state information of transport bindings vs interceptors and initialise them separately.