Check BIO_flush return value.

That we're ignoring the return value is clearly wrong when
dtls1_retransmit_message has other code that doesn't ignore it, by way of
dtls1_do_handshake_write.

Change-Id: Ie3f8c0defdf1f5e709d67af4ca6fa4f0d83c76c9
Reviewed-on: https://boringssl-review.googlesource.com/7872
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 7bd2824..e14eae7 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -759,10 +759,11 @@
     }
   }
 
-  /* TODO(davidben): Check return value? */
-  (void)BIO_flush(SSL_get_wbio(ssl));
-
-  ret = 1;
+  ret = BIO_flush(SSL_get_wbio(ssl));
+  if (ret <= 0) {
+    ssl->rwstate = SSL_WRITING;
+    goto err;
+  }
 
 err:
   if (!was_buffered) {