mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 17:52:54 +03:00
Make endpoint->sessions and context->sessions a hashed chain of sessions based on a key comprising of local and remote addresses and ports instead of a linked list that has to be linearly searched. include/coap2/coap_io.h: include/coap2/coap_session.h: Create a new struct coap_addr_tuple_t for the local and remote addresses/ports to be used as the hash key. Update coap_packet_t and coap_session_t appropriately. Create SESSIONS_* macros to Add, Delete, Find and Iterate through the hashed chain. examples/coap-rd.c: src/coap_io.c: src/coap_io_lwip.c: src/coap_openssl.c: src/coap_session.c: src/coap_tinydtls.c: src/net.c: src/resource.c: Update with the new struct element names and replace the LL_* functions with SESSIONS_* as appropriate. Update coap_endpoint_get_session() to use SESSIONS_FIND() for fast lookup. Future work is to review all the SESSIONS_ITER* and see if they can be sped up as well.