Changeset 6039
- Timestamp:
- Jul 17, 2019 7:22:00 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_sock.c
r6020 r6039 1358 1358 } 1359 1359 1360 if (conn->state == DATACONN_STATE_READY) { 1361 /* Application data */ 1362 if (turn_sock->cb.on_rx_data) { 1363 (*turn_sock->cb.on_rx_data)(turn_sock, data, size, 1364 &conn->peer_addr, 1365 conn->peer_addr_len); 1366 } 1367 } else if (conn->state == DATACONN_STATE_CONN_BINDING) { 1368 /* Waiting for ConnectionBind response */ 1369 pj_bool_t is_stun; 1370 pj_turn_session_on_rx_pkt_param prm; 1371 1372 /* Ignore if this is not a STUN message */ 1373 is_stun = ((((pj_uint8_t*)data)[0] & 0xC0) == 0); 1374 if (!is_stun) 1375 goto on_return; 1376 1377 pj_bzero(&prm, sizeof(prm)); 1378 prm.pkt = data; 1379 prm.pkt_len = size; 1380 prm.src_addr = &conn->peer_addr; 1381 prm.src_addr_len = conn->peer_addr_len; 1382 pj_turn_session_on_rx_pkt2(conn->turn_sock->sess, &prm); 1383 /* Got remainder? */ 1384 if (prm.parsed_len < size) { 1385 *remainder = size - prm.parsed_len; 1386 if (prm.parsed_len) { 1387 pj_memmove(data, (pj_uint8_t*)data+prm.parsed_len, 1360 *remainder = size; 1361 while (*remainder > 0) { 1362 if (conn->state == DATACONN_STATE_READY) { 1363 /* Application data */ 1364 if (turn_sock->cb.on_rx_data) { 1365 (*turn_sock->cb.on_rx_data)(turn_sock, data, *remainder, 1366 &conn->peer_addr, 1367 conn->peer_addr_len); 1368 } 1369 *remainder = 0; 1370 } else if (conn->state == DATACONN_STATE_CONN_BINDING) { 1371 /* Waiting for ConnectionBind response */ 1372 pj_bool_t is_stun; 1373 pj_turn_session_on_rx_pkt_param prm; 1374 1375 /* Ignore if this is not a STUN message */ 1376 is_stun = ((((pj_uint8_t*)data)[0] & 0xC0) == 0); 1377 if (!is_stun) 1378 goto on_return; 1379 1380 pj_bzero(&prm, sizeof(prm)); 1381 prm.pkt = data; 1382 prm.pkt_len = *remainder; 1383 prm.src_addr = &conn->peer_addr; 1384 prm.src_addr_len = conn->peer_addr_len; 1385 pj_turn_session_on_rx_pkt2(conn->turn_sock->sess, &prm); 1386 /* Got remainder? */ 1387 if (prm.parsed_len < *remainder && prm.parsed_len > 0) { 1388 pj_memmove(data, (pj_uint8_t*)data + prm.parsed_len, 1388 1389 *remainder); 1389 1390 } 1390 } 1391 *remainder -= prm.parsed_len; 1392 } else 1393 goto on_return; 1391 1394 } 1392 1395
Note: See TracChangeset
for help on using the changeset viewer.