mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12429 from kjbracey-arm/chrono_dtls
DTLSSocketWrapper: Convert to Chronopull/12971/head
commit
f4015c7eaa
|
@ -50,8 +50,11 @@ void DTLSSocketWrapper::timing_set_delay(void *ctx, uint32_t int_ms, uint32_t fi
|
|||
return;
|
||||
}
|
||||
|
||||
context->_int_ms_tick = rtos::Kernel::get_ms_count() + int_ms;
|
||||
context->_timer_event_id = mbed::mbed_event_queue()->call_in(fin_ms, context, &DTLSSocketWrapper::timer_event);
|
||||
auto int_duration = std::chrono::duration<uint32_t, std::milli>(int_ms);
|
||||
auto fin_duration = std::chrono::duration<uint32_t, std::milli>(fin_ms);
|
||||
|
||||
context->_int_time = rtos::Kernel::Clock::now() + int_duration;
|
||||
context->_timer_event_id = mbed::mbed_event_queue()->call_in(fin_duration, context, &DTLSSocketWrapper::timer_event);
|
||||
}
|
||||
|
||||
int DTLSSocketWrapper::timing_get_delay(void *ctx)
|
||||
|
@ -64,7 +67,7 @@ int DTLSSocketWrapper::timing_get_delay(void *ctx)
|
|||
return -1;
|
||||
} else if (context->_timer_expired) {
|
||||
return 2;
|
||||
} else if (context->_int_ms_tick < rtos::Kernel::get_ms_count()) {
|
||||
} else if (context->_int_time < rtos::Kernel::Clock::now()) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define DTLSSOCKETWRAPPER_H
|
||||
|
||||
#include "TLSSocketWrapper.h"
|
||||
#include "rtos/Kernel.h"
|
||||
|
||||
// This class requires Mbed TLS SSL/TLS client code
|
||||
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
|
||||
|
@ -43,7 +44,7 @@ private:
|
|||
static void timing_set_delay(void *ctx, uint32_t int_ms, uint32_t fin_ms);
|
||||
static int timing_get_delay(void *ctx);
|
||||
void timer_event();
|
||||
uint64_t _int_ms_tick = 0;
|
||||
rtos::Kernel::Clock::time_point _int_time;
|
||||
int _timer_event_id = 0;
|
||||
bool _timer_expired = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue