Fix race condition in dtls_lib_init