diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2011-03-16 07:34:16 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2011-03-16 07:34:16 +0000 |
commit | 2a9988f3e4c9b8d40ffebaa4427908de29324711 (patch) | |
tree | 0fec17a1ff6201f61e16e3bb03821c62080be372 /pjlib/src/pj | |
parent | e8673ffff74a0e9a63ce789e884a98a369bc8cc3 (diff) |
Fix #1212:
- Updated pj_register_strerror() to just return PJ_SUCCESS when the same range
and handler is being re-registered.
- Removed the usage of static flag of error string handler registration in some
modules, which prevent the re-registration of the handler, e.g: in restarting
pjsua, as such flags never got reseted.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3455 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj')
-rw-r--r-- | pjlib/src/pj/errno.c | 8 | ||||
-rw-r--r-- | pjlib/src/pj/ssl_sock_ossl.c | 16 |
2 files changed, 14 insertions, 10 deletions
diff --git a/pjlib/src/pj/errno.c b/pjlib/src/pj/errno.c index e36b3266..40ac9779 100644 --- a/pjlib/src/pj/errno.c +++ b/pjlib/src/pj/errno.c @@ -128,6 +128,14 @@ PJ_DEF(pj_status_t) pj_register_strerror( pj_status_t start, if (IN_RANGE(start, err_msg_hnd[i].begin, err_msg_hnd[i].end) || IN_RANGE(start+space-1, err_msg_hnd[i].begin, err_msg_hnd[i].end)) { + if (err_msg_hnd[i].begin == start && + err_msg_hnd[i].end == (start+space) && + err_msg_hnd[i].strerror == f) + { + /* The same range and handler has already been registered */ + return PJ_SUCCESS; + } + return PJ_EEXISTS; } } diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c index 97458835..98888906 100644 --- a/pjlib/src/pj/ssl_sock_ossl.c +++ b/pjlib/src/pj/ssl_sock_ossl.c @@ -267,7 +267,6 @@ static pj_str_t ssl_strerror(pj_status_t status, /* OpenSSL library initialization counter */ static int openssl_init_count; -static int openssl_reg_strerr; /* OpenSSL available ciphers */ static pj_ssl_cipher openssl_ciphers[100]; @@ -280,21 +279,18 @@ static int sslsock_idx; /* Initialize OpenSSL */ static pj_status_t init_openssl(void) { + pj_status_t status; + if (openssl_init_count) return PJ_SUCCESS; openssl_init_count = 1; /* Register error subsystem */ - if (!openssl_reg_strerr) { - pj_status_t status; - - openssl_reg_strerr = 1; - status = pj_register_strerror(PJ_SSL_ERRNO_START, - PJ_SSL_ERRNO_SPACE_SIZE, - &ssl_strerror); - pj_assert(status == PJ_SUCCESS); - } + status = pj_register_strerror(PJ_SSL_ERRNO_START, + PJ_SSL_ERRNO_SPACE_SIZE, + &ssl_strerror); + pj_assert(status == PJ_SUCCESS); /* Init OpenSSL lib */ SSL_library_init(); |