summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-05-03 16:00:05 +0100
committerMatt Caswell <matt@openssl.org>2018-05-11 13:54:56 +0100
commiteb49905e605241dd1369d54df264976f8ea7f823 (patch)
treed89c6d4a86ce903304a9f28250f0996632744a6d /ssl
parent960e7bfb32af0ff3586ae2b4953d1228fa43ea16 (diff)
Only auto-retry for DTLS if configured to do so
Otherwise we may end up in a hang when using blocking sockets Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6196)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/record/rec_layer_d1.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c
index c753a54a22..083dac4339 100644
--- a/ssl/record/rec_layer_d1.c
+++ b/ssl/record/rec_layer_d1.c
@@ -849,6 +849,18 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
dtls1_retransmit_buffered_messages(s);
SSL3_RECORD_set_length(rr, 0);
+ if (!(s->mode & SSL_MODE_AUTO_RETRY)) {
+ if (SSL3_BUFFER_get_left(&s->rlayer.rbuf) == 0) {
+ /* no read-ahead left? */
+ BIO *bio;
+
+ s->rwstate = SSL_READING;
+ bio = SSL_get_rbio(s);
+ BIO_clear_retry_flags(bio);
+ BIO_set_retry_read(bio);
+ return -1;
+ }
+ }
goto start;
}