uses mavl now
FossilOrigin-Name: 2b3ecb32b8512b81e2a973950c57a26e86bfa85e1d15d1af5c30ffade595a82f
This commit is contained in:
parent
5464d95224
commit
adc6489d9b
@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
This file is part of actube.
|
||||||
|
|
||||||
|
actube is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
libcapwap is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -32,7 +49,7 @@ struct connlist * connlist_create(int len)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
cl->t = avltree_create(connlist_cmp,0);
|
cl->t = mavl_create(connlist_cmp,0);
|
||||||
|
|
||||||
if (!cl->t){
|
if (!cl->t){
|
||||||
free(cl);
|
free(cl);
|
||||||
@ -40,7 +57,7 @@ struct connlist * connlist_create(int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_mutex_init(&cl->connlist_mutex,NULL)){
|
if (pthread_mutex_init(&cl->connlist_mutex,NULL)){
|
||||||
avltree_destroy(cl->t);
|
mavl_destroy(cl->t);
|
||||||
free(cl);
|
free(cl);
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -67,7 +84,7 @@ void connlist_destroy(struct connlist * cl)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (cl->t)
|
if (cl->t)
|
||||||
avltree_destroy(cl->t);
|
mavl_destroy(cl->t);
|
||||||
pthread_mutex_destroy(&cl->connlist_mutex);
|
pthread_mutex_destroy(&cl->connlist_mutex);
|
||||||
free(cl);
|
free(cl);
|
||||||
|
|
||||||
@ -78,7 +95,7 @@ struct conn * connlist_get(struct connlist * cl, const struct sockaddr * addr)
|
|||||||
{
|
{
|
||||||
struct conn dummy;
|
struct conn dummy;
|
||||||
sock_copyaddr(&dummy.addr,addr);
|
sock_copyaddr(&dummy.addr,addr);
|
||||||
return avltree_get(cl->t,&dummy);
|
return mavl_get(cl->t,&dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -88,13 +105,13 @@ struct conn * connlist_add(struct connlist * cl, struct conn * conn)
|
|||||||
if (cl->t->count>=cl->len)
|
if (cl->t->count>=cl->len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return avltree_add(cl->t,conn);
|
return mavl_add(cl->t,conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void connlist_remove(struct connlist *cl,struct conn * conn)
|
void connlist_remove(struct connlist *cl,struct conn * conn)
|
||||||
{
|
{
|
||||||
avltree_del(cl->t,conn);
|
mavl_del(cl->t,conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user