Fixed some tee filter errors regarding closed sessions and qla filter not writing to the file when it locates in /tmp.

This commit is contained in:
Markus Makela 2015-02-25 15:37:42 +02:00
parent bdbe55233d
commit eb9d191437
2 changed files with 20 additions and 6 deletions

View File

@ -99,7 +99,7 @@ static FILTER_OBJECT MyObject = {
*/
typedef struct {
int sessions; /* The count of sessions */
char *filebase; /* The filemane base */
char *filebase; /* The filename base */
char *source; /* The source of the client connection */
char *userName; /* The user name to filter on */
char *match; /* Optional text to match against */
@ -424,8 +424,8 @@ struct timeval tv;
"%02d:%02d:%02d.%-3d %d/%02d/%d, ",
t.tm_hour, t.tm_min, t.tm_sec, (int)(tv.tv_usec / 1000),
t.tm_mday, t.tm_mon + 1, 1900 + t.tm_year);
fwrite(ptr, sizeof(char), length, my_session->fp);
fwrite("\n", sizeof(char), 1, my_session->fp);
fprintf(my_session->fp,"%s\n",ptr);
}
free(ptr);
}

View File

@ -777,6 +777,14 @@ char *ptr;
int length, rval, residual = 0;
GWBUF *clone = NULL;
unsigned char command = *((unsigned char*)queue->start + 4);
if(!my_session->active)
{
skygw_log_write(LOGFILE_TRACE, "Tee: Received a reply when the session was closed.");
gwbuf_free(queue);
return 0;
}
if (my_session->branch_session &&
my_session->branch_session->state == SESSION_STATE_ROUTER_READY)
{
@ -908,7 +916,12 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
spinlock_acquire(&my_session->tee_lock);
ss_dassert(my_session->active);
if(!my_session->active)
{
gwbuf_free(reply);
rc = 0;
goto retblock;
}
branch = instance == NULL ? CHILD : PARENT;
@ -1049,10 +1062,11 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
my_session->tee_replybuf);
my_session->tee_replybuf = NULL;
}
retblock:
spinlock_release(&my_session->tee_lock);
return rc;
}
}
/**
* Diagnostics routine
*