aiocoap icon indicating copy to clipboard operation
aiocoap copied to clipboard

Move tinydtls-cython workarounds into tinydtls-cython library

Open chrysn opened this issue 7 years ago • 1 comments

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):

  • Export constants; right now, I'm hard-copying DTLS_EVENT_CONNECT{,ED}, LEVEL_{WARNING,NOALERT} and some others into my code.
  • checkRetransmit (or, for orderly migration, a function of a different name) should give a relative time in known units (preferably seconds). Currently, I estimate the offset by looking at the wall time and hard-copied DTLS_TICKS_PER_SECOND to hopefully arrive at something similar to what the library wants me to do.
  • "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.

chrysn avatar Sep 20 '17 10:09 chrysn

Export constants; right now, I'm hard-copying DTLS_EVENT_CONNECT{,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.

rfuentess avatar Oct 10 '17 19:10 rfuentess