Added session idle time and user name the client is connecting with to the dprintSession and dprintAllSessions functions. Also changed last_read from time_t to unsigned long to match the hkheartbeat.
This commit is contained in:
@ -608,14 +608,21 @@ SESSION *ptr;
|
|||||||
ptr = allSessions;
|
ptr = allSessions;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
|
double idle = (hkheartbeat - ptr->client->last_read);
|
||||||
|
idle = idle > 0 ? idle/10.0:0;
|
||||||
dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr);
|
dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr);
|
||||||
dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state));
|
dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state));
|
||||||
dcb_printf(dcb, "\tService: %s (%p)\n", ptr->service->name, ptr->service);
|
dcb_printf(dcb, "\tService: %s (%p)\n", ptr->service->name, ptr->service);
|
||||||
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
|
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
|
||||||
if (ptr->client && ptr->client->remote)
|
if (ptr->client && ptr->client->remote)
|
||||||
dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote);
|
dcb_printf(dcb, "\tClient Address: %s%s%s\n",
|
||||||
|
ptr->client->user?ptr->client->user:"",
|
||||||
|
ptr->client->user?"@":"",
|
||||||
|
ptr->client->remote);
|
||||||
dcb_printf(dcb, "\tConnected: %s",
|
dcb_printf(dcb, "\tConnected: %s",
|
||||||
asctime_r(localtime_r(&ptr->stats.connect, &result), timebuf));
|
asctime_r(localtime_r(&ptr->stats.connect, &result), timebuf));
|
||||||
|
if(ptr->client->state == DCB_STATE_POLLING)
|
||||||
|
dcb_printf(dcb, "\tIdle: %.0f seconds\n",idle);
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
spinlock_release(&session_spin);
|
spinlock_release(&session_spin);
|
||||||
@ -637,14 +644,21 @@ struct tm result;
|
|||||||
char buf[30];
|
char buf[30];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
double idle = (hkheartbeat - ptr->client->last_read);
|
||||||
|
idle = idle > 0 ? idle/10.f:0;
|
||||||
dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr);
|
dcb_printf(dcb, "Session %d (%p)\n",ptr->ses_id, ptr);
|
||||||
dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state));
|
dcb_printf(dcb, "\tState: %s\n", session_state(ptr->state));
|
||||||
dcb_printf(dcb, "\tService: %s (%p)\n", ptr->service->name, ptr->service);
|
dcb_printf(dcb, "\tService: %s (%p)\n", ptr->service->name, ptr->service);
|
||||||
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
|
dcb_printf(dcb, "\tClient DCB: %p\n", ptr->client);
|
||||||
if (ptr->client && ptr->client->remote)
|
if (ptr->client && ptr->client->remote)
|
||||||
dcb_printf(dcb, "\tClient Address: %s\n", ptr->client->remote);
|
dcb_printf(dcb, "\tClient Address: %s%s%s\n",
|
||||||
|
ptr->client->user?ptr->client->user:"",
|
||||||
|
ptr->client->user?"@":"",
|
||||||
|
ptr->client->remote);
|
||||||
dcb_printf(dcb, "\tConnected: %s",
|
dcb_printf(dcb, "\tConnected: %s",
|
||||||
asctime_r(localtime_r(&ptr->stats.connect, &result), buf));
|
asctime_r(localtime_r(&ptr->stats.connect, &result), buf));
|
||||||
|
if(ptr->client->state == DCB_STATE_POLLING)
|
||||||
|
dcb_printf(dcb, "\tIdle: %.0f seconds",idle);
|
||||||
if (ptr->n_filters)
|
if (ptr->n_filters)
|
||||||
{
|
{
|
||||||
for (i = 0; i < ptr->n_filters; i++)
|
for (i = 0; i < ptr->n_filters; i++)
|
||||||
|
|||||||
@ -261,7 +261,7 @@ typedef struct dcb {
|
|||||||
SPINLOCK polloutlock;
|
SPINLOCK polloutlock;
|
||||||
int polloutbusy;
|
int polloutbusy;
|
||||||
int writecheck;
|
int writecheck;
|
||||||
time_t last_read; /*< Last time the DCB received data */
|
unsigned long last_read; /*< Last time the DCB received data */
|
||||||
unsigned int high_water; /**< High water mark */
|
unsigned int high_water; /**< High water mark */
|
||||||
unsigned int low_water; /**< Low water mark */
|
unsigned int low_water; /**< Low water mark */
|
||||||
struct server *server; /**< The associated backend server */
|
struct server *server; /**< The associated backend server */
|
||||||
|
|||||||
Reference in New Issue
Block a user