mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-17 13:29:05 +03:00
dtls_event is a static variable, declared outside of all the functions which tracks (D)TLS errors for generating events etc. If there are multiple SSL sessions being set up to the same server (as per Happy Eyeballs for the DOTS protocol) it is possible to asynchronously get dtls_event updated and the wrong SSL session then acts on it. Make dtls_event a part of coap_session_t to maintain seperation. Preset dtls_event to -1 in coap_make_session(). Update coap_event_handler() to have the 3rd parameter as coap_session_t *session instead of void *arg as the parameter is always session. Updated coap_event_handler_t to have session as the 3rd parameter. Add in new registration handler coap_register_event_handler() to be consistent with all the other coap_register_XXX_handler()s. Consequently, coap_set_event_handler() and coap_clear_enent_handler() are deprecated. Update coap_handler(3) to include new coap_register_event_handler(). (PR #183 event definitions are included presumptive on #183 getting merged)