NAME
on_disconnect
- is invoked when a connection is closed.
SYNOPSIS
#include <game-carrier/server.h>
GC_ADAPTER_EVENT
void on_disconnect(
GCT_INTPTR conn_user);
Parameters:
conn_user
GCT_INTPTR
Identifier of the closed connection.
RETURN VALUE
None.
DESCRIPTION
The on_disconnect
function is invoked by the gcs
when a connection is
closed. It serves as the final event triggered for a connection, indicating
that the connection has been terminated or disconnected.
The conn_user
parameter represents the connection ID that was previously returned
by the on_connect
call. It uniquely identifies the connection that has been
closed and serves as a reference to retrieve any associated information or
perform specific actions related to that connection.
EXAMPLE
#include <game-carrier/server.h>
struct connection_data {
GCT_INTPTR handle;
/* user data associated with connection */
};
GC_ADAPTER_EVENT
void on_disconnect(
GCT_INTPTR cid)
{
struct connection_data * data = (struct connection_data *)cid;
/* Deallocate user connection data */
free(data);
}