From d573c0779a9dad2883942af87a4be9d1d4322d3f Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 3 Jun 2013 18:01:30 +0200 Subject: [PATCH] use lwip pools for observations --- lwippools.h | 6 ++++++ resource.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lwippools.h b/lwippools.h index 39c3f0d7..c1d197ae 100644 --- a/lwippools.h +++ b/lwippools.h @@ -5,9 +5,15 @@ * MEMP_USE_CUSTOM_POOLS has to be set in lwipopts.h. */ #include +#include #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") diff --git a/resource.c b/resource.c index 6866b0ec..a00ba13a 100644 --- a/resource.c +++ b/resource.c @@ -12,6 +12,10 @@ #include "resource.h" #include "subscribe.h" +#ifdef WITH_LWIP +#include +#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 } }