diff --git a/server/modules/filter/qlafilter.c b/server/modules/filter/qlafilter.c index 74c176e02..c9af0a839 100644 --- a/server/modules/filter/qlafilter.c +++ b/server/modules/filter/qlafilter.c @@ -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); } diff --git a/server/modules/filter/tee.c b/server/modules/filter/tee.c index 47f5f2d84..08d88d5e7 100644 --- a/server/modules/filter/tee.c +++ b/server/modules/filter/tee.c @@ -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 *