A CTDB_ON_SESSION_LOGOUT callback is invoked before a session logout is performed. The handle passed as a parameter with this callback is a session handle and you can safely typecast the handle parameter as a pCTDBSESSION structure pointer.
The session logout callback can be used to undo and cleanup operations performed by a session logon callback. No other callbacks calls will be issued after a CTDB_ON_SESSION_LOGOUT callback.
c-treeDB API C API Example
CTDBRET ctdbDECL OnSessionLogout(CTHANDLE Handle)
{
CTDBRET Retval = CTDBRET_OK;
pCTDBSESSION pSession = (pCTDBSESSION)Handle;
if (!pSession)
Retval = CTDBRET_NOTSESSION;
else
{
/* release any memory allocated by session logon callback */
if (pSession->localTag)
{
pSession->OnFree(pSession->localTag)
pSession->localTag = NULL;
}
}
return Retval;
}