Changeset 5152 for pjproject/trunk
- Timestamp:
- Aug 7, 2015 9:00:52 AM (9 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_config.h
r5090 r5152 671 671 672 672 /** 673 * Specify whether TCP transport should skip creating the listener. 674 * Not having a listener means that application will not be able to 675 * function in server mode and accept incoming connections. 676 * 677 * When enabling this setting, if you use PJSUA, it is recommended to set 678 * pjsua_acc_config.contact_use_src_port to PJ_TRUE. 679 * Warning: If contact_use_src_port is disabled or failed (because it's 680 * unsupported in some platforms or automatically turned off due to 681 * DNS server resolution), Contact header will be generated from 682 * pj_getipinterface()/pj_gethostip(), but the address will not be 683 * able to accept connections. 684 * 685 * Default is FALSE (listener will be created). 686 */ 687 #ifndef PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER 688 # define PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER 0 689 #endif 690 691 692 /** 693 * Specify whether TLS transport should skip creating the listener. 694 * Not having a listener means that application will not be able to 695 * function in server mode and accept incoming connections. 696 * 697 * When enabling this setting, if you use PJSUA, it is recommended to set 698 * pjsua_acc_config.contact_use_src_port to PJ_TRUE. 699 * Warning: If contact_use_src_port is disabled or failed (because it's 700 * unsupported in some platforms or automatically turned off due to 701 * DNS server resolution), Contact header will be generated from 702 * pj_getipinterface()/pj_gethostip(), but the address will not be 703 * able to accept connections. 704 * 705 * Default is FALSE (listener will be created). 706 */ 707 #ifndef PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER 708 # define PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER 0 709 #endif 710 711 712 /** 673 713 * Set the interval to send keep-alive packet for TCP transports. 674 714 * If the value is zero, keep-alive will be disabled for TCP. -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
r5105 r5152 259 259 pj_sockaddr *listener_addr; 260 260 int addr_len; 261 pj_bool_t has_listener = PJ_FALSE; 261 262 pj_status_t status; 262 263 … … 279 280 } 280 281 281 pool = pjsip_endpt_create_pool(endpt, "tcp lis", POOL_LIS_INIT,282 pool = pjsip_endpt_create_pool(endpt, "tcptp", POOL_LIS_INIT, 282 283 POOL_LIS_INC); 283 284 PJ_ASSERT_RETURN(pool, PJ_ENOMEM); … … 298 299 sizeof(cfg->sockopt_params)); 299 300 300 pj_ansi_strcpy(listener->factory.obj_name, "tcp lis");301 pj_ansi_strcpy(listener->factory.obj_name, "tcptp"); 301 302 if (listener->factory.type==PJSIP_TRANSPORT_TCP6) 302 303 pj_ansi_strcat(listener->factory.obj_name, "6"); … … 307 308 goto on_error; 308 309 310 #if !(defined(PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER) && \ 311 PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER != 0) 309 312 310 313 /* Create socket */ … … 333 336 status = pj_sock_setsockopt_params(sock, &cfg->sockopt_params); 334 337 338 #else 339 PJ_UNUSED_ARG(addr_len); 340 #endif 341 335 342 /* Bind address may be different than factory.local_addr because 336 343 * factory.local_addr will be resolved below. … … 341 348 listener_addr = &listener->factory.local_addr; 342 349 pj_sockaddr_cp(listener_addr, &cfg->bind_addr); 350 351 #if !(defined(PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER) && \ 352 PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER != 0) 343 353 344 354 status = pj_sock_bind(sock, listener_addr, … … 352 362 if (status != PJ_SUCCESS) 353 363 goto on_error; 364 365 #endif 354 366 355 367 /* If published host/IP is specified, then use that address as the … … 393 405 pj_ansi_snprintf(listener->factory.obj_name, 394 406 sizeof(listener->factory.obj_name), 395 "tcplis:%d", listener->factory.addr_name.port); 396 407 "tcptp:%d", listener->factory.addr_name.port); 408 409 410 #if !(defined(PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER) && \ 411 PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER != 0) 397 412 398 413 /* Start listening to the address */ … … 409 424 asock_cfg.async_cnt = cfg->async_cnt; 410 425 426 #endif 427 411 428 /* Create group lock */ 412 429 status = pj_grp_lock_create(pool, NULL, &listener->grp_lock); … … 422 439 pj_bzero(&listener_cb, sizeof(listener_cb)); 423 440 listener_cb.on_accept_complete = &on_accept_complete; 441 442 #if !(defined(PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER) && \ 443 PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER != 0) 444 424 445 status = pj_activesock_create(pool, sock, pj_SOCK_STREAM(), &asock_cfg, 425 446 pjsip_endpt_get_ioqueue(endpt), 426 447 &listener_cb, listener, 427 448 &listener->asock); 449 450 #endif 428 451 429 452 /* Register to transport manager */ … … 440 463 } 441 464 465 #if !(defined(PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER) && \ 466 PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER != 0) 467 442 468 /* Start pending accept() operations */ 443 469 status = pj_activesock_start_accept(listener->asock, pool); 444 470 if (status != PJ_SUCCESS) 445 471 goto on_error; 446 447 PJ_LOG(4,(listener->factory.obj_name, 448 "SIP TCP listener ready for incoming connections at %.*s:%d", 449 (int)listener->factory.addr_name.host.slen, 450 listener->factory.addr_name.host.ptr, 451 listener->factory.addr_name.port)); 472 473 has_listener = PJ_TRUE; 474 475 #endif 476 477 if (has_listener) { 478 PJ_LOG(4,(listener->factory.obj_name, 479 "SIP TCP listener ready for incoming connections at %.*s:%d", 480 (int)listener->factory.addr_name.host.slen, 481 listener->factory.addr_name.host.ptr, 482 listener->factory.addr_name.port)); 483 } else { 484 PJ_LOG(4,(listener->factory.obj_name, "SIP TCP is ready " 485 "(client only)")); 486 } 452 487 453 488 /* Return the pointer to user */ … … 519 554 pj_pool_t *pool = listener->factory.pool; 520 555 521 PJ_LOG(4,(listener->factory.obj_name, "SIP TCP listenerdestroyed"));556 PJ_LOG(4,(listener->factory.obj_name, "SIP TCP transport destroyed")); 522 557 523 558 listener->factory.pool = NULL; -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
r5105 r5152 340 340 } 341 341 342 pool = pjsip_endpt_create_pool(endpt, "tls lis", POOL_LIS_INIT,342 pool = pjsip_endpt_create_pool(endpt, "tlstp", POOL_LIS_INIT, 343 343 POOL_LIS_INC); 344 344 PJ_ASSERT_RETURN(pool, PJ_ENOMEM); … … 355 355 pjsip_transport_get_flag_from_type(listener->factory.type); 356 356 357 pj_ansi_strcpy(listener->factory.obj_name, "tls lis");357 pj_ansi_strcpy(listener->factory.obj_name, "tlstp"); 358 358 if (is_ipv6) 359 359 pj_ansi_strcat(listener->factory.obj_name, "6"); … … 420 420 &lis_on_destroy); 421 421 422 #if !(defined(PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER) && \ 423 PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER != 0) 424 422 425 ssock_param.grp_lock = listener->grp_lock; 423 426 … … 426 429 if (status != PJ_SUCCESS) 427 430 goto on_error; 431 432 #endif 428 433 429 434 /* Bind address may be different than factory.local_addr because … … 439 444 pj_sockaddr_init(af, &listener->bound_addr, NULL, 0); 440 445 } 446 447 #if !(defined(PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER) && \ 448 PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER != 0) 441 449 442 450 /* Check if certificate/CA list for SSL socket is set */ … … 481 489 } 482 490 491 #endif 492 483 493 /* If published host/IP is specified, then use that address as the 484 494 * listener advertised address. … … 519 529 pj_ansi_snprintf(listener->factory.obj_name, 520 530 sizeof(listener->factory.obj_name), 521 "tls lis:%d", listener->factory.addr_name.port);531 "tlstp:%d", listener->factory.addr_name.port); 522 532 523 533 /* Register to transport manager */ … … 570 580 pj_pool_t *pool = listener->factory.pool; 571 581 572 PJ_LOG(4,(listener->factory.obj_name, "SIP TLS listenerdestroyed"));582 PJ_LOG(4,(listener->factory.obj_name, "SIP TLS transport destroyed")); 573 583 574 584 listener->factory.pool = NULL;
Note: See TracChangeset
for help on using the changeset viewer.