question about ngx_ssl_clear_error()

何龙 lh2008999 at gmail.com
Wed Jan 28 13:58:33 UTC 2015


in src/event/ngx_event_openssl.c:1907, i found function
ngx_ssl_clear_error() call openssl function ERR_peek_error() in a
while loop, intend to clear global error code queue,

but according to openssl's documents and source code, ERR_peek_error() will not
pop the first error code , and  it does not modify the queue.

so it looks like this will cause a busy loop.

is my understanding correct?

reference:

nginx source code
"
static void
ngx_ssl_clear_error(ngx_log_t *log)
{
    while (ERR_peek_error()) {
        ngx_ssl_error(NGX_LOG_ALERT, log, 0, "ignoring stale global SSL error");
    }

    ERR_clear_error();
}

"

openssl source code:
https://github.com/openssl/openssl/blob/master/crypto/err/err.c#L770



More information about the nginx-devel mailing list