Commit f77736e8 authored by Arne Øslebø's avatar Arne Øslebø
Browse files

mapi_read_result bugfix

git-svn-id: file:///home/svn/mapi/trunk@337 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 0fd81135
......@@ -27,7 +27,7 @@ WITH_PRIORITIES=1
PRIORITIES=3
#Support for functions that modifies packets
WITH_MODIFY_PKTS=1
WITH_MODIFY_PKTS=0
#Support for anonymization
WITH_ANONYMIZATION=0
......
......@@ -546,6 +546,7 @@ int mapi_create_flow(char *dev)
flow->devtype=(char *)malloc(strlen((char *)qbuf.data)+1);
flow->flist=malloc(sizeof(flist_t));
flow->shm_base=NULL;
flow->shm_spinlock=NULL;
flow->error=0;
flow->errstr[0]='\0';
flist_init(flow->flist);
......@@ -618,6 +619,7 @@ int mapi_create_offline_flow(char *dev, int format)
flow->devtype=(char *)malloc(strlen((char *)qbuf.data)+1);
flow->flist=malloc(sizeof(flist_t));
flow->shm_base=NULL;
flow->shm_spinlock=NULL;
flow->error=0;
flow->errstr[0]='\0';
flist_init(flow->flist);
......@@ -847,6 +849,7 @@ int mapi_close_flow(int fd)
}
if(f->result!=NULL)
free(f->result);
free(f->funct->instance);
free(f->funct);
free(f->data);
free(f);
......@@ -1745,8 +1748,7 @@ default_read_result_init(flowdescr_t *flow,functdescr_t* f,void* data)
f->funct->instance->result.data_size=shm->res_size;
f->result=(void *)malloc(((shm_result_t*)f->data)->size);
return 0;
}
......
......@@ -1654,7 +1654,7 @@ cmd_read_results (int fd, int fid, int pid, int sock)
p += sizeof (result->shm);
memcpy (p, result->funct_res, result->funct_res_size);
}
buf.size = result->funct_res_size + sizeof (mapid_shm_t);
buf.size = result->funct_res_size + 2*sizeof (mapid_shm_t);
}
else
{
......
......@@ -356,7 +356,7 @@ mapid_connect(mapidlib_instance_t *i,int fd)
//Set information about spinlock
fi->result.info.shm_spinlock.key=i->shm_spinlock_key;
fi->result.info.shm_spinlock.buf_size=i->shm_spinlock_size;
fi->result.info.shm.offset=0;
fi->result.info.shm_spinlock.offset=0;
}
if(fi->def->init!=NULL) {
......@@ -586,6 +586,8 @@ mapid_read_results(mapidlib_instance_t *i,
} else
*result=&funct->instance->result.info;
return 0;
}
......@@ -979,7 +981,7 @@ void mapid_process_pkt(mapidlib_instance_t *i,
#endif
n2=flist_head(flow->procfunctionlist);
ret=1;
while (n2 && ret && flow->status==FLOW_ACTIVE) {
while (n2 && ret!=0 && flow->status==FLOW_ACTIVE) {
funct = flist_data(n2);
if(funct->ref==1)
ret=funct->instance->ret;
......
......@@ -25,8 +25,6 @@ typedef struct res2file_inst {
void *data;
int save;
int type;
int* fids;
int* fds;
unsigned long long ticks;
unsigned long long last;
} res2file_inst_t;
......@@ -270,9 +268,7 @@ static int res2file_cleanup(mapidflib_function_instance_t *instance)
close(i->file);
free(i->functs);
free(i->types);
free(i->fids);
free(i->fds);
free(i);
free(i);
return 0;
}
......
Test
26 60 1089376572.304825321073
27 60 1089376572.304825321073
18 62 1089376576.802628111560
9 60 1089376581.784199971240
11 60 1089376586.288109193789
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment