RT832: Use REUSEADDR in ocsp responder

I also re-ordered some of #ifdef's.

Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
Rich Salz 2015-05-02 10:44:31 -04:00 committed by Rich Salz
parent f20bb4eb18
commit 366e2a60b2

View File

@ -1010,22 +1010,27 @@ static BIO *init_responder(const char *port)
{ {
BIO *acbio = NULL, *bufbio = NULL; BIO *acbio = NULL, *bufbio = NULL;
# ifdef OPENSSL_NO_SOCK
BIO_printf(bio_err,
"Error setting up accept BIO - sockets not supported.\n");
return NULL;
# endif
bufbio = BIO_new(BIO_f_buffer()); bufbio = BIO_new(BIO_f_buffer());
if (!bufbio) if (!bufbio)
goto err; goto err;
# ifndef OPENSSL_NO_SOCK acbio = BIO_new(BIO_s_accept());
acbio = BIO_new_accept(port); if (acbio == NULL
# else || BIO_set_bind_mode(acbio, BIO_BIND_REUSEADDR) < 0
BIO_printf(bio_err, || BIO_set_accept_port(acbio, port) < 0) {
"Error setting up accept BIO - sockets not supported.\n"); BIO_printf(bio_err, "Error setting up accept BIO\n");
# endif ERR_print_errors(bio_err);
if (!acbio)
goto err; goto err;
}
BIO_set_accept_bios(acbio, bufbio); BIO_set_accept_bios(acbio, bufbio);
bufbio = NULL; bufbio = NULL;
if (BIO_do_accept(acbio) <= 0) { if (BIO_do_accept(acbio) <= 0) {
BIO_printf(bio_err, "Error setting up accept BIO\n"); BIO_printf(bio_err, "Error starting accept\n");
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto err; goto err;
} }