dtls: Properly display all errors/warnings from ERR queue
Conversion of the patch from #677 (comment 66858) into a MR made up of several commits.
Additional changes:
- Implement @nirbheek's suggestion from #677 (comment 66859) and raise the log level for
errno != 0
- Add an
ERR_clear_error
call as required by SSL_get_error - Replace an if-else-chain with a switch
Edited by Jan Alexander Steffens