NAME

application_stop - Notifies the application about the server shutdown.

SYNOPSIS

#include <game-carrier/server.h>

GC_ADAPTER_EVENT
void application_stop(
    GCT_INT app_id);

Parameters:

  • app_id GCT_INT Unique identifier of the application.

RETURN VALUE

None.

DESCRIPTION

The application_stop function is used to notify the application that the server will be shutting down shortly.

Upon calling this function, the application is forced to inform connected clients that it will close connections shortly. This behavior also applies to other application tasks that must be completed before exiting.

After the function is executed, all network operations will no longer be possible.

The application_stop function is invoked by the gcs for each application specified in the server configuration.

The app_id parameter represents the unique identifier of the application. This value is also used when the application_initialize is called.

EXAMPLE

#include <game-carrier/server.h>

GC_ADAPTER_EVENT
GCT_INT application_initialize(
    GCT_INT id,
    GCT_CSTR name,
    GCT_CSTR type_name,
    GCT_CSTR file_name)
{
    /**
     * Here is a good place for:
     *   - initialization/allocation global application resources
     *   - creating application related counters
     **/
    return 0;
}

GC_ADAPTER_EVENT
void application_start(
    GCT_INT id)
{
    /**
     * Here is a good place for:
     *   - starting networking activity
     *   - obtaining counter names list
     **/
}

GC_ADAPTER_EVENT
void application_stop(
    GCT_INT id)
{
    /* Here is good place for last networking commucations */
}

GC_ADAPTER_EVENT
void application_shutdown(
    GCT_INT id)
{
    /* Here is good place for deinitialization/deallocation global application resources */
}

SEE ALSO

application_shutdown, adapter_finalize, application_initialize