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:
@ -99,7 +99,7 @@ static FILTER_OBJECT MyObject = {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int sessions; /* The count of sessions */
|
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 *source; /* The source of the client connection */
|
||||||
char *userName; /* The user name to filter on */
|
char *userName; /* The user name to filter on */
|
||||||
char *match; /* Optional text to match against */
|
char *match; /* Optional text to match against */
|
||||||
@ -424,8 +424,8 @@ struct timeval tv;
|
|||||||
"%02d:%02d:%02d.%-3d %d/%02d/%d, ",
|
"%02d:%02d:%02d.%-3d %d/%02d/%d, ",
|
||||||
t.tm_hour, t.tm_min, t.tm_sec, (int)(tv.tv_usec / 1000),
|
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);
|
t.tm_mday, t.tm_mon + 1, 1900 + t.tm_year);
|
||||||
fwrite(ptr, sizeof(char), length, my_session->fp);
|
fprintf(my_session->fp,"%s\n",ptr);
|
||||||
fwrite("\n", sizeof(char), 1, my_session->fp);
|
|
||||||
}
|
}
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -777,6 +777,14 @@ char *ptr;
|
|||||||
int length, rval, residual = 0;
|
int length, rval, residual = 0;
|
||||||
GWBUF *clone = NULL;
|
GWBUF *clone = NULL;
|
||||||
unsigned char command = *((unsigned char*)queue->start + 4);
|
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 &&
|
if (my_session->branch_session &&
|
||||||
my_session->branch_session->state == SESSION_STATE_ROUTER_READY)
|
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);
|
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;
|
branch = instance == NULL ? CHILD : PARENT;
|
||||||
|
|
||||||
@ -1049,10 +1062,11 @@ clientReply (FILTER* instance, void *session, GWBUF *reply)
|
|||||||
my_session->tee_replybuf);
|
my_session->tee_replybuf);
|
||||||
my_session->tee_replybuf = NULL;
|
my_session->tee_replybuf = NULL;
|
||||||
}
|
}
|
||||||
|
retblock:
|
||||||
spinlock_release(&my_session->tee_lock);
|
spinlock_release(&my_session->tee_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diagnostics routine
|
* Diagnostics routine
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user