67 #include "../crypto/internal.h"
75 #define DTLS1_MTU_TIMEOUTS 2
79 #define DTLS1_MAX_TIMEOUTS 12
82 : has_change_cipher_spec(
false),
83 outgoing_messages_complete(
false),
84 flight_has_reply(
false) {}
92 UniquePtr<DTLS1_STATE> d1 = MakeUnique<DTLS1_STATE>();
98 ssl->
d1 = d1.release();
122 if (ssl->
d1->next_timeout.tv_sec == 0 && ssl->
d1->next_timeout.tv_usec == 0) {
130 ssl->
d1->next_timeout.tv_sec += ssl->
d1->timeout_duration_ms / 1000;
131 ssl->
d1->next_timeout.tv_usec += (ssl->
d1->timeout_duration_ms % 1000) * 1000;
132 if (ssl->
d1->next_timeout.tv_usec >= 1000000) {
133 ssl->
d1->next_timeout.tv_sec++;
134 ssl->
d1->next_timeout.tv_usec -= 1000000;
156 ssl->
d1->timeout_duration_ms *= 2;
157 if (ssl->
d1->timeout_duration_ms > 60000) {
158 ssl->
d1->timeout_duration_ms = 60000;
163 ssl->
d1->num_timeouts = 0;
169 ssl->
d1->num_timeouts++;
176 if (mtu >= 0 && mtu <= (1 << 30) && (
unsigned)mtu >=
dtls1_min_mtu()) {
177 ssl->
d1->mtu = (unsigned)mtu;
192 using namespace bssl;
204 if (ssl->
d1->next_timeout.tv_sec == 0 && ssl->
d1->next_timeout.tv_usec == 0) {
212 if (ssl->
d1->next_timeout.tv_sec < timenow.
tv_sec ||
213 (ssl->
d1->next_timeout.tv_sec == timenow.
tv_sec &&
214 ssl->
d1->next_timeout.tv_usec <= timenow.
tv_usec)) {
232 if (
ret.tv_sec == 0 &&
ret.tv_usec < 15000) {
237 if (
ret.tv_sec > INT_MAX) {
239 out->tv_sec = INT_MAX;
244 out->tv_usec =
ret.tv_usec;