Commit 0f8230ef authored by Arne Øslebø's avatar Arne Øslebø

reverted back to old method of closing flows to avoid race condition

git-svn-id: file:///home/svn/mapi/trunk@1226 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 224f0dfe
......@@ -267,7 +267,7 @@ process_pkts(void *buf,unsigned len, dag_instance_t *i)
i->hwinfo.pkts++;
}
//mapid_delete_flows(&i->mapidlib);
mapid_delete_flows(&i->mapidlib);
return len - c;
......@@ -311,7 +311,7 @@ process_pkts_offline(void *buf,unsigned len, dag_instance_t *i)
i->hwinfo.pkts++;
}
//mapid_delete_flows(&i->mapidlib);
mapid_delete_flows(&i->mapidlib);
return len - c;
......
......@@ -116,8 +116,8 @@ mapid_init(mapidlib_instance_t *i)
struct group *mapi_group;
struct shmid_ds shm_data;
//pthread_mutex_init(&i->lock,NULL);
//flist_init(&i->close);
pthread_mutex_init(&i->lock,NULL);
flist_init(&i->close);
#ifdef WITH_PRIORITIES
int j = 0;
......@@ -591,7 +591,7 @@ static void delete_flow(mapidlib_instance_t *i,struct mapidlibflow *flow) {
// pthread_spin_unlock(lock);
}
/*
void mapid_delete_flows(mapidlib_instance_t *i) {
flist_node_t *n;
int fd;
......@@ -608,8 +608,6 @@ void mapid_delete_flows(mapidlib_instance_t *i) {
pthread_mutex_unlock(&i->lock);
}
*/
//Frees resources allocated by mapidlib, should be called by the drivers when devices are deleted
......@@ -997,7 +995,7 @@ mapid_close_flow(mapidlib_instance_t *i,int fd)
if(f==NULL)
return -1;
/*
f->status=FLOW_CLOSED;
//Update global function list
((mapid_flow_info_t*)flist_get(f->hwinfo->gflist->fflist,f->fd))->status=FLOW_CLOSED;
......@@ -1009,9 +1007,9 @@ mapid_close_flow(mapidlib_instance_t *i,int fd)
flist_append(&i->close,fd,NULL);
pthread_mutex_unlock(&i->lock);
*/
//TODO: it is not possible to delete flows here as it can cause race condition with process packet thread
//it is not possible to delete flows here as it can cause race condition with process packet thread
// delete_flow(i, f);
......
......@@ -54,8 +54,8 @@ typedef struct mapidlib_instance {
key_t shm_spinlock_key;
int shm_spinlock_id;
char shm_spinlock_fname[MAPI_STR_LENGTH];
//pthread_mutex_t lock;
//flist_t close;
pthread_mutex_t lock;
flist_t close;
}mapidlib_instance_t;
......
......@@ -205,6 +205,8 @@ process_pkts(void *buf,unsigned len, nic_instance_t *i,MAPI_UNUSED int devid, in
rlen = rec->caplen+sizeof(struct pcap_pkthdr);
}
mapid_delete_flows(&i->mapidlib);
return len - c;
}
......
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