Fix functions and logic.
Add new functions Add logic into AC for create/destroy station
This commit is contained in:
@ -3,6 +3,9 @@
|
||||
/* */
|
||||
#define CAPWAP_TIMEOUT_HASH_COUNT 128
|
||||
|
||||
/* */
|
||||
/* #define CAPWAP_TIMEOUT_LOGGING_DEBUG 1 */
|
||||
|
||||
/* */
|
||||
static unsigned long capwap_timeout_hash_item_gethash(const void* key, unsigned long keysize, unsigned long hashsize) {
|
||||
return (*(unsigned long*)key % hashsize);
|
||||
@ -121,7 +124,10 @@ unsigned long capwap_timeout_createtimer(struct capwap_timeout* timeout) {
|
||||
|
||||
/* Create new timeout index */
|
||||
index = capwap_timeout_set_bitfield(timeout);
|
||||
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Create new timer: %lu", index);
|
||||
#endif
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -131,7 +137,9 @@ void capwap_timeout_deletetimer(struct capwap_timeout* timeout, unsigned long in
|
||||
ASSERT(timeout != NULL);
|
||||
|
||||
if (index != CAPWAP_TIMEOUT_INDEX_NO_SET) {
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Delete timer: %lu", index);
|
||||
#endif
|
||||
|
||||
/* Unset timeout timer */
|
||||
capwap_timeout_unset(timeout, index);
|
||||
@ -169,7 +177,9 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i
|
||||
item->context = context;
|
||||
item->param = param;
|
||||
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Update timeout: %lu %ld", item->index, item->durate);
|
||||
#endif
|
||||
|
||||
/* Add itemlist into order list */
|
||||
capwap_timeout_additem(timeout->itemstimeout, itemlist);
|
||||
@ -189,7 +199,9 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i
|
||||
item->context = context;
|
||||
item->param = param;
|
||||
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Set timeout: %lu %ld", item->index, item->durate);
|
||||
#endif
|
||||
|
||||
/* Add itemlist into hash for rapid searching */
|
||||
capwap_hash_add(timeout->itemsreference, (const void*)&item->index, (void*)itemlist);
|
||||
@ -209,7 +221,11 @@ void capwap_timeout_unset(struct capwap_timeout* timeout, unsigned long index) {
|
||||
if (index != CAPWAP_TIMEOUT_INDEX_NO_SET) {
|
||||
itemlist = (struct capwap_list_item*)capwap_hash_search(timeout->itemsreference, &index);
|
||||
if (itemlist) {
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Unset timeout: %lu", index);
|
||||
#endif
|
||||
|
||||
/* */
|
||||
capwap_hash_delete(timeout->itemsreference, &index);
|
||||
capwap_itemlist_free(capwap_itemlist_remove(timeout->itemstimeout, itemlist));
|
||||
}
|
||||
@ -281,7 +297,9 @@ unsigned long capwap_timeout_hasexpired(struct capwap_timeout* timeout) {
|
||||
itemlist = capwap_itemlist_remove_head(timeout->itemstimeout);
|
||||
item = (struct capwap_timeout_item*)itemlist->item;
|
||||
|
||||
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
|
||||
capwap_logging_debug("Expired timeout: %lu", item->index);
|
||||
#endif
|
||||
|
||||
/* Cache callback before release timeout timer */
|
||||
index = item->index;
|
||||
|
Reference in New Issue
Block a user