mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Fix s_client and s_server so that they correctly handle the DTLS timer
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6170)
This commit is contained in:
parent
f20404fce9
commit
6f6da2fe17
@ -2703,8 +2703,7 @@ int s_client_main(int argc, char **argv)
|
|||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
FD_ZERO(&writefds);
|
FD_ZERO(&writefds);
|
||||||
|
|
||||||
if ((SSL_version(con) == DTLS1_VERSION) &&
|
if (SSL_is_dtls(con) && DTLSv1_get_timeout(con, &timeout))
|
||||||
DTLSv1_get_timeout(con, &timeout))
|
|
||||||
timeoutp = &timeout;
|
timeoutp = &timeout;
|
||||||
else
|
else
|
||||||
timeoutp = NULL;
|
timeoutp = NULL;
|
||||||
@ -2815,10 +2814,8 @@ int s_client_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((SSL_version(con) == DTLS1_VERSION)
|
if (SSL_is_dtls(con) && DTLSv1_handle_timeout(con) > 0)
|
||||||
&& DTLSv1_handle_timeout(con) > 0) {
|
|
||||||
BIO_printf(bio_err, "TIMEOUT occurred\n");
|
BIO_printf(bio_err, "TIMEOUT occurred\n");
|
||||||
}
|
|
||||||
|
|
||||||
if (!ssl_pending && FD_ISSET(SSL_get_fd(con), &writefds)) {
|
if (!ssl_pending && FD_ISSET(SSL_get_fd(con), &writefds)) {
|
||||||
k = SSL_write(con, &(cbuf[cbuf_off]), (unsigned int)cbuf_len);
|
k = SSL_write(con, &(cbuf[cbuf_off]), (unsigned int)cbuf_len);
|
||||||
|
@ -2398,18 +2398,15 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
|
|||||||
if ((i < 0) || (!i && !read_from_terminal))
|
if ((i < 0) || (!i && !read_from_terminal))
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
if ((SSL_version(con) == DTLS1_VERSION) &&
|
if (SSL_is_dtls(con) && DTLSv1_get_timeout(con, &timeout))
|
||||||
DTLSv1_get_timeout(con, &timeout))
|
|
||||||
timeoutp = &timeout;
|
timeoutp = &timeout;
|
||||||
else
|
else
|
||||||
timeoutp = NULL;
|
timeoutp = NULL;
|
||||||
|
|
||||||
i = select(width, (void *)&readfds, NULL, NULL, timeoutp);
|
i = select(width, (void *)&readfds, NULL, NULL, timeoutp);
|
||||||
|
|
||||||
if ((SSL_version(con) == DTLS1_VERSION)
|
if ((SSL_is_dtls(con)) && DTLSv1_handle_timeout(con) > 0)
|
||||||
&& DTLSv1_handle_timeout(con) > 0) {
|
|
||||||
BIO_printf(bio_err, "TIMEOUT occurred\n");
|
BIO_printf(bio_err, "TIMEOUT occurred\n");
|
||||||
}
|
|
||||||
|
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user