Changeset 6034
- Timestamp:
- Jul 1, 2019 5:41:29 AM (5 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c
r6022 r6034 211 211 } 212 212 213 #define ERROR_LOG(msg, err) \ 214 PJ_LOG(2,("SSL", "%s (%s): Level: %d err: <%lu> <%s-%s-%s> len: %d", \ 215 msg, action, level, err, \ 216 (ERR_lib_error_string(err)? ERR_lib_error_string(err): "???"), \ 217 (ERR_func_error_string(err)? ERR_func_error_string(err):"???"),\ 218 (ERR_reason_error_string(err)? \ 219 ERR_reason_error_string(err): "???"), len)); 220 221 static void SSLLogErrors(char * action, int ret, int ssl_err, int len) 213 #define ERROR_LOG(msg, err, ssock) \ 214 { \ 215 char buf[PJ_INET6_ADDRSTRLEN+10]; \ 216 PJ_LOG(2,("SSL", "%s (%s): Level: %d err: <%lu> <%s-%s-%s> len: %d " \ 217 "peer: %s", \ 218 msg, action, level, err, \ 219 (ERR_lib_error_string(err)? ERR_lib_error_string(err): "???"), \ 220 (ERR_func_error_string(err)? ERR_func_error_string(err):"???"),\ 221 (ERR_reason_error_string(err)? \ 222 ERR_reason_error_string(err): "???"), len, \ 223 (ssock && pj_sockaddr_has_addr(&ssock->rem_addr)? \ 224 pj_sockaddr_print(&ssock->rem_addr, buf, sizeof(buf), 3):"???")));\ 225 } 226 227 static void SSLLogErrors(char * action, int ret, int ssl_err, int len, 228 pj_ssl_sock_t *ssock) 222 229 { 223 230 char *ssl_err_str = SSLErrorString(ssl_err); … … 234 241 int level = 0; 235 242 while (err2) { 236 ERROR_LOG("SSL_ERROR_SYSCALL", err2 );243 ERROR_LOG("SSL_ERROR_SYSCALL", err2, ssock); 237 244 level++; 238 245 err2 = ERR_get_error(); … … 265 272 266 273 while (err2) { 267 ERROR_LOG("SSL_ERROR_SSL", err2 );274 ERROR_LOG("SSL_ERROR_SSL", err2, ssock); 268 275 level++; 269 276 err2 = ERR_get_error(); … … 303 310 int len = 0; //dummy 304 311 305 ERROR_LOG("STATUS_FROM_SSL_ERR", err );312 ERROR_LOG("STATUS_FROM_SSL_ERR", err, ssock); 306 313 level++; 307 314 … … 309 316 if (err == SSL_ERROR_SSL) { 310 317 err = ERR_get_error(); 311 ERROR_LOG("STATUS_FROM_SSL_ERR", err );318 ERROR_LOG("STATUS_FROM_SSL_ERR", err, ssock); 312 319 } 313 320 … … 327 334 328 335 /* Dig for more from OpenSSL error queue */ 329 SSLLogErrors(action, ret, err, len );336 SSLLogErrors(action, ret, err, len, ssock); 330 337 331 338 ssock->last_err = ssl_err; -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
r6004 r6034 174 174 175 175 static void tls_perror(const char *sender, const char *title, 176 pj_status_t status) 177 { 178 PJ_PERROR(3,(sender, status, "%s: [code=%d]", title, status)); 176 pj_status_t status, pj_str_t *remote_name) 177 { 178 PJ_PERROR(3,(sender, status, "%s: [code=%d]%s%.*s", title, status, 179 remote_name ? " peer: " : "", remote_name ? remote_name->slen : 0, 180 remote_name ? remote_name->ptr : "")); 179 181 } 180 182 … … 731 733 if (status != PJ_SUCCESS) { 732 734 tls_perror(listener->factory.obj_name, 733 "Unable to start listener after closing it", status );735 "Unable to start listener after closing it", status, NULL); 734 736 735 737 return status; … … 740 742 if (status != PJ_SUCCESS) { 741 743 tls_perror(listener->factory.obj_name, 742 "Unable to register the transport listener", status );744 "Unable to register the transport listener", status, NULL); 743 745 744 746 listener->is_registered = PJ_FALSE; … … 1086 1088 PJSIP_POOL_RDATA_INC); 1087 1089 if (!pool) { 1088 tls_perror(tls->base.obj_name, "Unable to create pool", PJ_ENOMEM); 1090 tls_perror(tls->base.obj_name, "Unable to create pool", PJ_ENOMEM, 1091 NULL); 1089 1092 return PJ_ENOMEM; 1090 1093 } … … 1773 1776 if (status != PJ_SUCCESS) { 1774 1777 1775 tls_perror(tls->base.obj_name, "TLS connect() error", status); 1778 tls_perror(tls->base.obj_name, "TLS connect() error", status, 1779 &tls->remote_name); 1776 1780 1777 1781 /* Cancel all delayed transmits */ … … 1917 1921 if (is_shutdown) { 1918 1922 status = tls->close_reason; 1919 tls_perror(tls->base.obj_name, "TLS connect() error", status); 1923 tls_perror(tls->base.obj_name, "TLS connect() error", status, 1924 &tls->remote_name); 1920 1925 1921 1926 /* Cancel all delayed transmits */ … … 2016 2021 if (status != PJ_SUCCESS && status != PJ_EPENDING) { 2017 2022 tls_perror(tls->base.obj_name, 2018 "Error sending keep-alive packet", status); 2023 "Error sending keep-alive packet", status, 2024 &tls->remote_name); 2019 2025 2020 2026 tls_init_shutdown(tls, status);
Note: See TracChangeset
for help on using the changeset viewer.