use lwip pools for observations

This commit is contained in:
chrysn committed 2013-11-17 16:43:51 +01:00
1 parent 22e1e5093c
commit d573c0779a
2 files changed
+23

No files matched your search

+6
View File
@@ -5,9 +5,15 @@
* MEMP_USE_CUSTOM_POOLS has to be set in lwipopts.h. */
#include <net.h>
#include <subscribe.h>
#ifndef MEMP_NUM_COAPNODE
#define MEMP_NUM_COAPNODE 4
#endif
#ifndef MEMP_NUM_COAP_SUBSCRIPTION
#define MEMP_NUM_COAP_SUBSCRIPTION 4
#endif
LWIP_MEMPOOL(COAP_NODE, MEMP_NUM_COAPNODE, sizeof(coap_queue_t), "COAP_NODE")
LWIP_MEMPOOL(COAP_subscription, MEMP_NUM_COAP_SUBSCRIPTION, sizeof(coap_subscription_t), "COAP_subscription")
+17
View File
@@ -12,6 +12,10 @@
#include "resource.h"
#include "subscribe.h"
#ifdef WITH_LWIP
#include <lwip/memp.h>
#endif
#ifndef WITH_CONTIKI
#include "utlist.h"
#include "mem.h"
@@ -585,7 +589,20 @@ coap_delete_observer(coap_resource_t *resource, const coap_address_t *observer,
if (s) {
list_remove(resource->subscribers, s);
<<<<<<< HEAD
COAP_FREE_TYPE(subscription,s);
=======
/* FIXME: notify observer that its subscription has been removed */
#ifdef WITH_LWIP
memp_free(MEMP_COAP_SUBSCRIBER, s);
#endif
#ifdef WITH_POSIX
coap_free(s);
#endif
#ifdef WITH_CONTIKI
memb_free(&subscription_storage, s);
#endif /* WITH_CONTIKI */
>>>>>>> use lwip pools for observations
}
}