diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-08-12 13:21:26 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-08-12 13:21:26 +0000 |
commit | a4bade7aaca2f31c8b3e4e2b9f1bf5da5570f6e2 (patch) | |
tree | 5ffb65dbf09646f3b61132915b517f487042bd4c /apps/s_server.c | |
parent | e322b5d167066db7caa4e9cedaeaec680ec8c75b (diff) |
PR: 1997
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de>
Approved by: steve@openssl.org
DTLS timeout handling fix.
Diffstat (limited to 'apps/s_server.c')
-rw-r--r-- | apps/s_server.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index 5ebbf6b876..9ccf2f0a44 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -1750,6 +1750,7 @@ static int sv_body(char *hostname, int s, unsigned char *context) unsigned long l; SSL *con=NULL; BIO *sbio; + struct timeval timeout, *timeoutp; #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5) struct timeval tv; #endif @@ -1808,7 +1809,6 @@ static int sv_body(char *hostname, int s, unsigned char *context) if (SSL_version(con) == DTLS1_VERSION) { - struct timeval timeout; sbio=BIO_new_dgram(s,BIO_NOCLOSE); @@ -1919,7 +1919,19 @@ static int sv_body(char *hostname, int s, unsigned char *context) read_from_terminal = 1; (void)fcntl(fileno(stdin), F_SETFL, 0); #else - i=select(width,(void *)&readfds,NULL,NULL,NULL); + if ((SSL_version(con) == DTLS1_VERSION) && + DTLSv1_get_timeout(con, &timeout)) + timeoutp = &timeout; + else + timeoutp = NULL; + + i=select(width,(void *)&readfds,NULL,NULL,timeoutp); + + if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0) + { + BIO_printf(bio_err,"TIMEOUT occured\n"); + } + if (i <= 0) continue; if (FD_ISSET(fileno(stdin),&readfds)) read_from_terminal = 1; |