Initialization & Finalization

This section describes the events that occur in the Game Carrier Server program (gcs) when it starts and stops.

Start

The adapter_initialize event is the first event that takes place after loading a shared object. It is called for each adapter in the configuration file with the type "native". As an argument of this event, a pointer to the core_api structure is passed. This event provides an excellent opportunity to initialize some global data.

The application_initialize event is called next for each application listed in the configuration files. It is called once for each application associated with the given adapter, as specified in the "apps" field in the config. Network communication is unavailable at this stage, making it a suitable place to initialize some local data related to the application and create counters. It is essential to note that at this point, counterGetNames will only return basic counters and will not include counters created by other applications.

The application_start event is called after the application_initialize event when network communication is available. It serves as a suitable place to establish connections with other applications and receive all available counters. Importantly, this event is called before any incoming connection events (such as on_connect). counterGetNames will return all counters on the server, but it’s important to note that creating new counters after receiving this event is not possible.

Stop

The application_stop event serves as the initial notification about stopping a server. At this stage, network communication is unavailable. It provides an excellent opportunity to close connections, send notification messages, and perform other necessary tasks related to the server shutdown.

The application_stop event acts as the first notification that the server is stopping. During this stage, network communication is unavailable. It presents an excellent opportunity to close connections, send notification messages, free allocated resources, and perform any other necessary tasks related to the server shutdown.

The adapter_shutdown event is the final event that occurs before unloading a shared object. It provides a suitable moment to release any remaining resources that still need to be freed.