Changeset 1654 for pjproject/trunk/pjnath/src/pjnath/ice_session.c
- Timestamp:
- Jan 2, 2008 8:24:10 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_session.c
r1574 r1654 18 18 */ 19 19 #include <pjnath/ice_session.h> 20 #include <pjnath/errno.h>21 20 #include <pj/addr_resolv.h> 22 21 #include <pj/array.h> … … 262 261 name = "ice%p"; 263 262 264 pool = pj_pool_create(stun_cfg->pf, name, 4000, 4000, NULL); 263 pool = pj_pool_create(stun_cfg->pf, name, PJNATH_POOL_LEN_ICE_SESS, 264 PJNATH_POOL_INC_ICE_SESS, NULL); 265 265 ice = PJ_POOL_ZALLOC_T(pool, pj_ice_sess); 266 266 ice->pool = pool; … … 558 558 pj_ice_sess_cand *lcand; 559 559 pj_status_t status = PJ_SUCCESS; 560 char tmp[128];561 560 562 561 PJ_ASSERT_RETURN(ice && comp_id && … … 585 584 586 585 587 pj_ansi_strcpy( tmp, pj_inet_ntoa(lcand->addr.ipv4.sin_addr));586 pj_ansi_strcpy(ice->tmp.txt, pj_inet_ntoa(lcand->addr.ipv4.sin_addr)); 588 587 LOG4((ice->obj_name, 589 588 "Candidate %d added: comp_id=%d, type=%s, foundation=%.*s, " … … 594 593 (int)lcand->foundation.slen, 595 594 lcand->foundation.ptr, 596 tmp,595 ice->tmp.txt, 597 596 (int)pj_ntohs(lcand->addr.ipv4.sin_port), 598 597 pj_inet_ntoa(lcand->base_addr.ipv4.sin_addr), … … 734 733 const pj_ice_sess_cand *lcand = check->lcand; 735 734 const pj_ice_sess_cand *rcand = check->rcand; 736 char laddr[ CHECK_NAME_LEN];735 char laddr[PJ_INET6_ADDRSTRLEN]; 737 736 int len; 737 738 PJ_CHECK_STACK(); 738 739 739 740 pj_ansi_strcpy(laddr, pj_inet_ntoa(lcand->addr.ipv4.sin_addr)); … … 761 762 } 762 763 763 static void dump_checklist(const char *title, constpj_ice_sess *ice,764 static void dump_checklist(const char *title, pj_ice_sess *ice, 764 765 const pj_ice_sess_checklist *clist) 765 766 { 766 767 unsigned i; 767 char buffer[CHECK_NAME_LEN];768 768 769 769 LOG4((ice->obj_name, "%s", title)); … … 771 771 const pj_ice_sess_check *c = &clist->checks[i]; 772 772 LOG4((ice->obj_name, " %s (%s, state=%s)", 773 dump_check( buffer, sizeof(buffer), clist, c),773 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), clist, c), 774 774 (c->nominated ? "nominated" : "not nominated"), 775 775 check_state_name[c->state])); … … 785 785 pj_status_t err_code) 786 786 { 787 char buf[CHECK_NAME_LEN];788 789 787 pj_assert(check->state < PJ_ICE_SESS_CHECK_STATE_SUCCEEDED); 790 788 791 789 LOG5((ice->obj_name, "Check %s: state changed from %s to %s", 792 dump_check( buf, sizeof(buf), &ice->clist, check),790 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), &ice->clist, check), 793 791 check_state_name[check->state], 794 792 check_state_name[st])); … … 938 936 if (reason != NULL) { 939 937 /* Found duplicate, remove it */ 940 char buf[CHECK_NAME_LEN];941 942 938 LOG5((ice->obj_name, "Check %s pruned (%s)", 943 dump_check( buf, sizeof(buf), &ice->clist,944 939 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 940 &ice->clist, &clist->checks[j]), 945 941 reason)); 946 942 … … 976 972 { 977 973 if (!ice->is_complete) { 978 char errmsg[PJ_ERR_MSG_SIZE];979 980 974 ice->is_complete = PJ_TRUE; 981 975 ice->ice_status = status; … … 983 977 /* Log message */ 984 978 LOG4((ice->obj_name, "ICE process complete, status=%s", 985 pj_strerror(status, errmsg, sizeof(errmsg)).ptr)); 979 pj_strerror(status, ice->tmp.errmsg, 980 sizeof(ice->tmp.errmsg)).ptr)); 986 981 987 982 dump_checklist("Valid list", ice, &ice->valid_list); … … 1057 1052 if (check->err_code==PJ_SUCCESS && check->nominated) { 1058 1053 pj_ice_sess_comp *comp; 1059 char buf[CHECK_NAME_LEN];1060 1054 1061 1055 LOG5((ice->obj_name, "Check %d is successful and nominated", … … 1075 1069 LOG5((ice->obj_name, 1076 1070 "Check %s to be failed because state is %s", 1077 dump_check(buf, sizeof(buf), &ice->clist, c), 1071 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 1072 &ice->clist, c), 1078 1073 check_state_name[c->state])); 1079 1074 check_set_state(ice, c, PJ_ICE_SESS_CHECK_STATE_FAILED, … … 1088 1083 LOG5((ice->obj_name, 1089 1084 "Cancelling check %s (In Progress)", 1090 dump_check(buf, sizeof(buf), &ice->clist, c))); 1085 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 1086 &ice->clist, c))); 1091 1087 pj_stun_session_cancel_req(comp->stun_sess, 1092 1088 c->tdata, PJ_FALSE, 0); … … 1369 1365 const pj_ice_sess_cand *rcand; 1370 1366 pj_uint32_t prio; 1371 char buffer[128];1372 1367 pj_status_t status; 1373 1368 … … 1379 1374 LOG5((ice->obj_name, 1380 1375 "Sending connectivity check for check %s", 1381 dump_check( buffer, sizeof(buffer), clist, check)));1376 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), clist, check))); 1382 1377 1383 1378 /* Create request */ … … 1554 1549 pj_ice_sess_checklist *clist; 1555 1550 const pj_ice_sess_cand *cand0; 1556 const pj_str_t *flist[PJ_ICE_MAX_CAND]; 1551 const pj_str_t *flist[PJ_ICE_MAX_CAND]; // XXX 1557 1552 pj_ice_rx_check *rcheck; 1558 1553 unsigned i, flist_cnt = 0; 1554 pj_time_val delay; 1555 pj_status_t status; 1559 1556 1560 1557 PJ_ASSERT_RETURN(ice, PJ_EINVAL); … … 1625 1622 1626 1623 /* Start periodic check */ 1627 return start_periodic_check(ice->stun_cfg.timer_heap, &clist->timer); 1624 /* We could start it immediately like below, but lets schedule timer 1625 * instead to reduce stack usage: 1626 * return start_periodic_check(ice->stun_cfg.timer_heap, &clist->timer); 1627 */ 1628 clist->timer.id = PJ_TRUE; 1629 delay.sec = delay.msec = 0; 1630 status = pj_timer_heap_schedule(ice->stun_cfg.timer_heap, 1631 &clist->timer, &delay); 1632 if (status != PJ_SUCCESS) { 1633 clist->timer.id = PJ_FALSE; 1634 } 1635 1636 return status; 1628 1637 } 1629 1638 … … 1662 1671 pj_ice_sess_checklist *clist; 1663 1672 pj_stun_xor_mapped_addr_attr *xaddr; 1664 char buffer[CHECK_NAME_LEN];1665 1673 unsigned i; 1666 1674 … … 1731 1739 LOG4((ice->obj_name, 1732 1740 "Check %s%s: connectivity check FAILED: %s", 1733 dump_check(buffer, sizeof(buffer), &ice->clist, check), 1741 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 1742 &ice->clist, check), 1734 1743 (check->nominated ? " (nominated)" : " (not nominated)"), 1735 1744 errmsg)); … … 1754 1763 LOG4((ice->obj_name, 1755 1764 "Check %s%s: connectivity check FAILED: source address mismatch", 1756 dump_check(buffer, sizeof(buffer), &ice->clist, check), 1765 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 1766 &ice->clist, check), 1757 1767 (check->nominated ? " (nominated)" : " (not nominated)"))); 1758 1768 check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status); … … 1780 1790 LOG4((ice->obj_name, 1781 1791 "Check %s%s: connectivity check SUCCESS", 1782 dump_check(buffer, sizeof(buffer), &ice->clist, check), 1792 dump_check(ice->tmp.txt, sizeof(ice->tmp.txt), 1793 &ice->clist, check), 1783 1794 (check->nominated ? " (nominated)" : " (not nominated)"))); 1784 1795 … … 2358 2369 NULL, src_addr, src_addr_len); 2359 2370 if (status != PJ_SUCCESS) { 2360 char errmsg[PJ_ERR_MSG_SIZE]; 2361 pj_strerror(status, errmsg, sizeof(errmsg)); 2371 pj_strerror(status, ice->tmp.errmsg, sizeof(ice->tmp.errmsg)); 2362 2372 LOG4((ice->obj_name, "Error processing incoming message: %s", 2363 errmsg));2373 ice->tmp.errmsg)); 2364 2374 } 2365 2375 } else {
Note: See TracChangeset
for help on using the changeset viewer.