- Timestamp:
- Dec 28, 2016 3:40:07 AM (8 years ago)
- Location:
- pjproject/branches/projects/uwp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/uwp
- Property svn:mergeinfo changed
/pjproject/trunk (added) merged: 5209,5212-5234,5237-5253,5255,5257-5292,5294-5297,5299-5332,5334-5394,5396-5438,5440-5469,5471-5496,5498-5510
- Property svn:mergeinfo changed
-
pjproject/branches/projects/uwp/pjsip/src/pjsip/sip_transport_tls.c
r5200 r5513 171 171 pj_strerror(status, errmsg, sizeof(errmsg)); 172 172 173 PJ_LOG( 1,(sender, "%s: %s [code=%d]", title, errmsg, status));173 PJ_LOG(3,(sender, "%s: %s [code=%d]", title, errmsg, status)); 174 174 } 175 175 … … 310 310 pjsip_tpfactory **p_factory) 311 311 { 312 enum { INFO_LEN = 100 }; 313 char local_addr[PJ_INET6_ADDRSTRLEN+10]; 312 314 pj_pool_t *pool; 313 315 pj_bool_t is_ipv6; … … 315 317 pj_uint32_t sip_ssl_proto; 316 318 struct tls_listener *listener; 317 pj_ssl_sock_param ssock_param ;319 pj_ssl_sock_param ssock_param, newsock_param; 318 320 pj_sockaddr *listener_addr; 319 321 pj_bool_t has_listener; … … 376 378 ssock_param.sock_af = af; 377 379 ssock_param.cb.on_accept_complete = &on_accept_complete; 378 ssock_param.cb.on_data_read = &on_data_read;379 ssock_param.cb.on_data_sent = &on_data_sent;380 380 ssock_param.async_cnt = async_cnt; 381 381 ssock_param.ioqueue = pjsip_endpt_get_ioqueue(endpt); 382 ssock_param.timer_heap = pjsip_endpt_get_timer_heap(endpt); 382 383 ssock_param.require_client_cert = listener->tls_setting.require_client_cert; 383 384 ssock_param.timeout = listener->tls_setting.timeout; … … 391 392 ssock_param.ciphers_num = listener->tls_setting.ciphers_num; 392 393 ssock_param.ciphers = listener->tls_setting.ciphers; 394 ssock_param.curves_num = listener->tls_setting.curves_num; 395 ssock_param.curves = listener->tls_setting.curves; 396 ssock_param.sigalgs = listener->tls_setting.sigalgs; 397 ssock_param.entropy_type = listener->tls_setting.entropy_type; 398 ssock_param.entropy_path = listener->tls_setting.entropy_path; 393 399 ssock_param.reuse_addr = listener->tls_setting.reuse_addr; 394 400 ssock_param.qos_type = listener->tls_setting.qos_type; … … 444 450 pj_sockaddr_init(af, &listener->bound_addr, NULL, 0); 445 451 } 446 447 #if !(defined(PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER) && \448 PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER != 0)449 452 450 453 /* Check if certificate/CA list for SSL socket is set */ … … 462 465 if (status != PJ_SUCCESS) 463 466 goto on_error; 464 467 } 468 469 #if !(defined(PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER) && \ 470 PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER != 0) 471 472 if (listener->cert) { 465 473 status = pj_ssl_sock_set_certificate(listener->ssock, pool, 466 474 listener->cert); … … 474 482 has_listener = PJ_FALSE; 475 483 476 status = pj_ssl_sock_start_accept(listener->ssock, pool, 484 pj_memcpy(&newsock_param, &ssock_param, sizeof(newsock_param)); 485 newsock_param.async_cnt = 1; 486 newsock_param.cb.on_data_read = &on_data_read; 487 newsock_param.cb.on_data_sent = &on_data_sent; 488 status = pj_ssl_sock_start_accept2(listener->ssock, pool, 477 489 (pj_sockaddr_t*)listener_addr, 478 pj_sockaddr_get_len((pj_sockaddr_t*)listener_addr)); 490 pj_sockaddr_get_len((pj_sockaddr_t*)listener_addr), 491 &newsock_param); 479 492 if (status == PJ_SUCCESS || status == PJ_EPENDING) { 480 493 pj_ssl_sock_info info; … … 543 556 goto on_error; 544 557 } 558 559 /* Set transport info. */ 560 if (listener->factory.info == NULL) { 561 listener->factory.info = (char*) pj_pool_alloc(listener->factory.pool, 562 INFO_LEN); 563 } 564 pj_sockaddr_print(listener_addr, local_addr, sizeof(local_addr), 3); 565 pj_ansi_snprintf( 566 listener->factory.info, INFO_LEN, "tls %s [published as %.*s:%d]", 567 local_addr, 568 (int)listener->factory.addr_name.host.slen, 569 listener->factory.addr_name.host.ptr, 570 listener->factory.addr_name.port); 545 571 546 572 if (has_listener) { … … 740 766 tls->base.do_shutdown = &tls_shutdown; 741 767 tls->base.destroy = &tls_destroy_transport; 768 tls->base.factory = &listener->factory; 742 769 743 770 tls->ssock = ssock; … … 1037 1064 ssock_param.async_cnt = 1; 1038 1065 ssock_param.ioqueue = pjsip_endpt_get_ioqueue(listener->endpt); 1066 ssock_param.timer_heap = pjsip_endpt_get_timer_heap(listener->endpt); 1039 1067 ssock_param.server_name = remote_name; 1040 1068 ssock_param.timeout = listener->tls_setting.timeout; … … 1048 1076 ssock_param.ciphers_num = listener->tls_setting.ciphers_num; 1049 1077 ssock_param.ciphers = listener->tls_setting.ciphers; 1078 ssock_param.curves_num = listener->tls_setting.curves_num; 1079 ssock_param.curves = listener->tls_setting.curves; 1080 ssock_param.sigalgs = listener->tls_setting.sigalgs; 1081 ssock_param.entropy_type = listener->tls_setting.entropy_type; 1082 ssock_param.entropy_path = listener->tls_setting.entropy_path; 1050 1083 ssock_param.qos_type = listener->tls_setting.qos_type; 1051 1084 ssock_param.qos_ignore_error = listener->tls_setting.qos_ignore_error; … … 1292 1325 /* Start keep-alive timer */ 1293 1326 if (pjsip_cfg()->tls.keep_alive_interval) { 1294 pj_time_val delay = {pjsip_cfg()->tls.keep_alive_interval, 0}; 1327 pj_time_val delay = {0}; 1328 delay.sec = pjsip_cfg()->tls.keep_alive_interval; 1295 1329 pjsip_endpt_schedule_timer(listener->endpt, 1296 1330 &tls->ka_timer, … … 1766 1800 /* Start keep-alive timer */ 1767 1801 if (pjsip_cfg()->tls.keep_alive_interval) { 1768 pj_time_val delay = { pjsip_cfg()->tls.keep_alive_interval, 0 }; 1802 pj_time_val delay = {0}; 1803 delay.sec = pjsip_cfg()->tls.keep_alive_interval; 1769 1804 pjsip_endpt_schedule_timer(tls->base.endpt, &tls->ka_timer, 1770 1805 &delay);
Note: See TracChangeset
for help on using the changeset viewer.