Addition of CheckSessions debug entry point
This commit is contained in:
@ -266,6 +266,67 @@ SESSION *ptr;
|
|||||||
spinlock_release(&session_spin);
|
spinlock_release(&session_spin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check sessions
|
||||||
|
*
|
||||||
|
* Designed to be called within a debugger session in order
|
||||||
|
* to display information regarding "interesting" sessions
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
CheckSessions()
|
||||||
|
{
|
||||||
|
SESSION *ptr;
|
||||||
|
int noclients = 0;
|
||||||
|
int norouter = 0;
|
||||||
|
|
||||||
|
spinlock_acquire(&session_spin);
|
||||||
|
ptr = allSessions;
|
||||||
|
while (ptr)
|
||||||
|
{
|
||||||
|
if (ptr->state != SESSION_STATE_LISTENER ||
|
||||||
|
ptr->state != SESSION_STATE_LISTENER_STOPPED)
|
||||||
|
{
|
||||||
|
if (ptr->client == NULL && ptr->refcount)
|
||||||
|
{
|
||||||
|
if (noclients == 0)
|
||||||
|
{
|
||||||
|
printf("Sessions without a client DCB.\n");
|
||||||
|
printf("==============================\n");
|
||||||
|
}
|
||||||
|
printSession(ptr);
|
||||||
|
noclients++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ptr = ptr->next;
|
||||||
|
}
|
||||||
|
spinlock_release(&session_spin);
|
||||||
|
if (noclients)
|
||||||
|
printf("%d Sessions have no clients\n", noclients);
|
||||||
|
spinlock_acquire(&session_spin);
|
||||||
|
ptr = allSessions;
|
||||||
|
while (ptr)
|
||||||
|
{
|
||||||
|
if (ptr->state != SESSION_STATE_LISTENER ||
|
||||||
|
ptr->state != SESSION_STATE_LISTENER_STOPPED)
|
||||||
|
{
|
||||||
|
if (ptr->router_session == NULL && ptr->refcount)
|
||||||
|
{
|
||||||
|
if (norouter == 0)
|
||||||
|
{
|
||||||
|
printf("Sessions without a router session.\n");
|
||||||
|
printf("==================================\n");
|
||||||
|
}
|
||||||
|
printSession(ptr);
|
||||||
|
norouter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ptr = ptr->next;
|
||||||
|
}
|
||||||
|
spinlock_release(&session_spin);
|
||||||
|
if (norouter)
|
||||||
|
printf("%d Sessions have no router session\n", norouter);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Print all sessions to a DCB
|
* Print all sessions to a DCB
|
||||||
*
|
*
|
||||||
|
|||||||
@ -71,7 +71,6 @@ typedef struct session {
|
|||||||
SPINLOCK ses_lock;
|
SPINLOCK ses_lock;
|
||||||
session_state_t state; /**< Current descriptor state */
|
session_state_t state; /**< Current descriptor state */
|
||||||
struct dcb *client; /**< The client connection */
|
struct dcb *client; /**< The client connection */
|
||||||
struct dcb *backends; /**< The set of backend servers */
|
|
||||||
void *data; /**< The session data */
|
void *data; /**< The session data */
|
||||||
void *router_session;/**< The router instance data */
|
void *router_session;/**< The router instance data */
|
||||||
SESSION_STATS stats; /**< Session statistics */
|
SESSION_STATS stats; /**< Session statistics */
|
||||||
|
|||||||
Reference in New Issue
Block a user