mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-02 02:47:09 +03:00
Fix for the signedness warning with gcc.
Compact coap_address_t. Use coap_queue_t for all queues. OpenSSL warning for close alert should be info level. Fix OpenSSL log level not working. Use the application defined MTU in OpenSSL. coap_log() optimization to avoid generating the log message text before testing the log level. coap_can_exit() should check the new retransmit queues. Fix retransmit time sometimes not correctly computed relative to sendqueue_basetime. Add coap_write() API call for applications with their own main loop.
This commit is contained in:
1 parent
4d4f3ba54f
commit
7fb4ace2b7
15 files changed
+407
-288
No files matched your search
+22
-12
@@ -19,6 +19,9 @@
|
||||
#include <tinydtls.h>
|
||||
#include <dtls.h>
|
||||
|
||||
static coap_time_t dtls_tick_0 = 0;
|
||||
static coap_tick_t coap_tick_0 = 0;
|
||||
|
||||
/* Prototypes from dtls_debug.h as including that header will conflict
|
||||
* with coap_config.h. */
|
||||
void dtls_set_log_level(int);
|
||||
@@ -31,6 +34,8 @@ coap_dtls_is_supported(void) {
|
||||
|
||||
void coap_dtls_startup(void) {
|
||||
dtls_init();
|
||||
dtls_ticks(&dtls_tick_0);
|
||||
coap_ticks(&coap_tick_0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -271,6 +276,11 @@ void *coap_dtls_new_client_session(coap_session_t *session) {
|
||||
return dtls_session;
|
||||
}
|
||||
|
||||
void
|
||||
coap_dtls_session_update_mtu(coap_session_t *session) {
|
||||
(void)session;
|
||||
}
|
||||
|
||||
void
|
||||
coap_dtls_free_session(coap_session_t *coap_session) {
|
||||
if (coap_session->tls) {
|
||||
@@ -299,21 +309,21 @@ coap_dtls_send(coap_session_t *session,
|
||||
return res;
|
||||
}
|
||||
|
||||
int coap_dtls_get_context_timeout(void *dtls_context) {
|
||||
clock_time_t next = 0;
|
||||
dtls_check_retransmit((struct dtls_context_t *)dtls_context, &next);
|
||||
if (next > 0) {
|
||||
clock_time_t now;
|
||||
dtls_ticks(&now);
|
||||
if (next >= now)
|
||||
return (int)(((next - now) * 1000 + DTLS_TICKS_PER_SECOND - 1) / DTLS_TICKS_PER_SECOND);
|
||||
}
|
||||
return -1;
|
||||
int coap_dtls_is_context_timeout(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int coap_dtls_get_timeout(coap_session_t *session) {
|
||||
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context) {
|
||||
clock_time_t next = 0;
|
||||
dtls_check_retransmit((struct dtls_context_t *)dtls_context, &next);
|
||||
if (next > 0)
|
||||
return ((coap_tick_t)(next - dtls_tick_0)) * COAP_TICKS_PER_SECOND / DTLS_TICKS_PER_SECOND + coap_tick_0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
coap_tick_t coap_dtls_get_timeout(coap_session_t *session) {
|
||||
(void)session;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void coap_dtls_handle_timeout(coap_session_t *session) {
|
||||
|
||||
Reference in new issue
Block a user