Added a dummy session and dcb to the filter harness.
This commit is contained in:
@ -69,6 +69,7 @@
|
||||
#include <ini.h>
|
||||
#include <hint.h>
|
||||
#include <modutil.h>
|
||||
#include <mysql_client_server_protocol.h>
|
||||
/**
|
||||
* A single name-value pair and a link to the next item in the
|
||||
* configuration.
|
||||
@ -125,6 +126,7 @@ typedef struct
|
||||
FILTERCHAIN* head; /**The head of the filter chain*/
|
||||
FILTERCHAIN* tail; /**The tail of the filter chain*/
|
||||
GWBUF** buffer; /**Buffers that are fed to the filter chain*/
|
||||
SESSION* session;
|
||||
int buffer_count;
|
||||
int session_count;
|
||||
DOWNSTREAM dummyrouter; /**Dummy downstream router for data extraction*/
|
||||
|
@ -1,5 +1,11 @@
|
||||
#include <harness.h>
|
||||
|
||||
int dcbfun(struct dcb* dcb, GWBUF * buffer)
|
||||
{
|
||||
printf("Data was written to client DCB.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int harness_init(int argc, char** argv){
|
||||
int i = 0;
|
||||
if(!(argc == 2 && strcmp(argv[1],"-h") == 0)){
|
||||
@ -20,6 +26,14 @@ int harness_init(int argc, char** argv){
|
||||
instance.buff_ind = -1;
|
||||
instance.last_ind = -1;
|
||||
instance.sess_ind = -1;
|
||||
instance.session = calloc(1,sizeof(SESSION));
|
||||
MYSQL_session* mysqlsess = calloc(1,sizeof(MYSQL_session));
|
||||
DCB* dcb = calloc(1,sizeof(DCB));
|
||||
|
||||
sprintf(mysqlsess->user,"dummyuser");
|
||||
sprintf(mysqlsess->db,"dummydb");
|
||||
dcb->func.write = dcbfun;
|
||||
instance.session->client = (void*)dcb;
|
||||
|
||||
process_opts(argc,argv);
|
||||
|
||||
@ -681,7 +695,7 @@ int load_filter(FILTERCHAIN* fc, CONFIG* cnf)
|
||||
|
||||
for(i = 0;i<instance.session_count;i++){
|
||||
|
||||
if((fc->session[i] = fc->instance->newSession(fc->filter, fc->session[i])) &&
|
||||
if((fc->session[i] = fc->instance->newSession(fc->filter, instance.session)) &&
|
||||
(fc->down[i] = calloc(1,sizeof(DOWNSTREAM))) &&
|
||||
(fc->up[i] = calloc(1,sizeof(UPSTREAM)))){
|
||||
|
||||
@ -693,7 +707,7 @@ int load_filter(FILTERCHAIN* fc, CONFIG* cnf)
|
||||
fc->instance->setUpstream(fc->filter, fc->session[i], fc->up[i]);
|
||||
}else{
|
||||
skygw_log_write(LOGFILE_MESSAGE,
|
||||
"Warning: The filter %s does not support client relies.\n",fc->name);
|
||||
"Warning: The filter %s does not support client replies.\n",fc->name);
|
||||
}
|
||||
|
||||
if(fc->next && fc->next->next){
|
||||
|
Reference in New Issue
Block a user