diff --git a/server/core/session.c b/server/core/session.c index d76ad6855..8344f9504 100644 --- a/server/core/session.c +++ b/server/core/session.c @@ -266,6 +266,67 @@ SESSION *ptr; 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 * diff --git a/server/include/session.h b/server/include/session.h index 37d1b52a2..ad00ed850 100644 --- a/server/include/session.h +++ b/server/include/session.h @@ -71,7 +71,6 @@ typedef struct session { SPINLOCK ses_lock; session_state_t state; /**< Current descriptor state */ struct dcb *client; /**< The client connection */ - struct dcb *backends; /**< The set of backend servers */ void *data; /**< The session data */ void *router_session;/**< The router instance data */ SESSION_STATS stats; /**< Session statistics */