chrysn / aiocoap

The Python CoAP library
Other
266 stars 120 forks source link

Move tinydtls-cython workarounds into tinydtls-cython library #90

Open chrysn opened 7 years ago

chrysn commented 7 years ago

Currently, there are some ugly workarounds in aiocoap's tinydtls usage, they should be properly documented (done here for now) and moved into upstream's bug tracker (which is not publically writable):

rfuentess commented 7 years ago

Export constants; right now, I'm hard-copying DTLS_EVENTCONNECT{,ED}, LEVEL{WARNING,NOALERT} and some others into my code.

I think that is possible to modify tinydtls-cython to accept an optional parameter for handling the verbosity of tinydtls syslog. With this approach, the user can define a verbosity from zero to eight which can be provided directly by the client using aiocoap (if required).

Also, for those people who truly want to save space, a custom compilation of tinydtls-cython with CFLAGS += -DNDEBUG (tinydtls-cython/tinydtls/Makefile) should be enough for disabling almost all the messages (if I remember well, alerts are still generated).

"I can do multiplexing myself thanks very much": tinydtls expects multiple sessions per DTLS object, but I really only use one ever (not having a global DTLS objects seems to be easier to manage) and always hand it sentinel IP/port values because it needs them to track the connection. If that's actually the design of tinydtls, it's not really something to be changed in the wrapper, but just needs good documentation on the aiocoap side.

I'll check how is tinydtls-cython handling the re-transmission of packets. This is one of the trickiest part for many RTOS as the tinydtls' standard solution is multi-threading. And should be invisible even to tinydtls-cython.