- Timestamp:
- Apr 13, 2009 6:30:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_session.c
r2589 r2590 1242 1242 } 1243 1243 1244 /* Otherwise if this is REFRESHresponse, notify application1244 /* Otherwise if this is not ALLOCATE response, notify application 1245 1245 * that session has been TERMINATED. 1246 1246 */ 1247 if (method ==PJ_STUN_REFRESH_METHOD) {1247 if (method!=PJ_STUN_ALLOCATE_METHOD) { 1248 1248 set_state(sess, PJ_TURN_STATE_DEALLOCATED); 1249 1249 sess_shutdown(sess, status); … … 1459 1459 const pj_str_t *err_msg = NULL; 1460 1460 1461 if (status == PJ_SUCCESS) { 1461 pj_assert(status != PJ_SUCCESS); 1462 1463 if (response) { 1462 1464 const pj_stun_errcode_attr *err_attr; 1463 1465 err_attr = (const pj_stun_errcode_attr*) … … 1467 1469 status = PJ_STATUS_FROM_STUN_CODE(err_attr->err_code); 1468 1470 err_msg = &err_attr->reason; 1469 } else {1470 status = PJNATH_EINSTUNMSG;1471 1471 } 1472 1472 } … … 1494 1494 } else { 1495 1495 /* Failed ChannelBind response */ 1496 pj_str_t err_msg = {"", 0}; 1497 1498 if (status == PJ_SUCCESS) { 1496 pj_str_t reason = {"", 0}; 1497 int err_code = 0; 1498 char errbuf[PJ_ERR_MSG_SIZE]; 1499 1500 pj_assert(status != PJ_SUCCESS); 1501 1502 if (response) { 1499 1503 const pj_stun_errcode_attr *err_attr; 1500 1504 err_attr = (const pj_stun_errcode_attr*) … … 1502 1506 PJ_STUN_ATTR_ERROR_CODE, 0); 1503 1507 if (err_attr) { 1508 err_code = err_attr->err_code; 1504 1509 status = PJ_STATUS_FROM_STUN_CODE(err_attr->err_code); 1505 err_msg = err_attr->reason; 1506 } else { 1507 status = PJNATH_EINSTUNMSG; 1510 reason = err_attr->reason; 1508 1511 } 1512 } else { 1513 err_code = status; 1514 reason = pj_strerror(status, errbuf, sizeof(errbuf)); 1509 1515 } 1510 1516 1511 PJ_LOG(4,(sess->obj_name, "ChannelBind failed: %.*s", 1512 (int)err_msg.slen, err_msg.ptr)); 1517 PJ_LOG(1,(sess->obj_name, "ChannelBind failed: %d/%.*s", 1518 err_code, (int)reason.slen, reason.ptr)); 1519 1520 if (err_code == PJ_STUN_SC_ALLOCATION_MISMATCH) { 1521 /* Allocation mismatch means allocation no longer exists */ 1522 on_session_fail(sess, PJ_STUN_CHANNEL_BIND_METHOD, 1523 status, &reason); 1524 return; 1525 } 1513 1526 } 1514 1527 … … 1529 1542 pj_str_t reason; 1530 1543 1531 if (status != PJ_SUCCESS) { 1532 err_code = status; 1533 reason = pj_strerror(status, errbuf, sizeof(errbuf)); 1534 } else { 1544 pj_assert(status != PJ_SUCCESS); 1545 1546 if (response) { 1535 1547 const pj_stun_errcode_attr *eattr; 1536 1548 … … 1545 1557 reason = pj_str("?"); 1546 1558 } 1559 } else { 1560 err_code = status; 1561 reason = pj_strerror(status, errbuf, sizeof(errbuf)); 1547 1562 } 1548 1563 … … 1562 1577 invalidate_perm(sess, perm); 1563 1578 } 1579 } 1580 1581 if (err_code == PJ_STUN_SC_ALLOCATION_MISMATCH) { 1582 /* Allocation mismatch means allocation no longer exists */ 1583 on_session_fail(sess, PJ_STUN_CREATE_PERM_METHOD, 1584 status, &reason); 1585 return; 1564 1586 } 1565 1587 }
Note: See TracChangeset
for help on using the changeset viewer.