Changeset 286:6241a8b649e0 in mediastreamer2
- Timestamp:
- Mar 3, 2009 5:37:07 PM (4 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
linphone/mediastreamer2/src/ice.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
linphone/mediastreamer2/src/ice.c
r283 r286 87 87 req.hasUseCandidate = TRUE; 88 88 89 if (remote_candidate->rem_controlvalue==0) 90 { 91 /* calculated once only */ 92 remote_candidate->rem_controlvalue = random(); 93 remote_candidate->rem_controlvalue = remote_candidate->rem_controlvalue >> 32; 94 remote_candidate->rem_controlvalue = random(); 95 } 89 if (remote_candidate->rem_controlvalue==0) { 90 /* calculated once only */ 91 remote_candidate->rem_controlvalue = random() * (0x7fffffffffffffff/0x7fff); 92 } 96 93 97 94 if (remote_candidate->rem_controlling==1) … … 414 411 } 415 412 416 if ((remote_candidates[0].rem_controlling==0 && msg.hasIceControlling) 417 ||(remote_candidates[0].rem_controlling==1 && msg.hasIceControlled)) 418 { 419 char buf[STUN_MAX_MESSAGE_SIZE]; 420 int len = sizeof(buf); 421 ms_error("487 Role Conflict"); 422 _ice_createErrorResponse(&resp, 4, 87, "Role Conflict"); 423 len = stunEncodeMessage(&resp, buf, len, &hmacPassword ); 424 if (len) 425 sendMessage( rtp_socket, buf, len, remote_addr.addr, remote_addr.port); 426 return -1; 427 } 428 429 413 if (remote_candidates->rem_controlvalue==0) { 414 /* calculated once only */ 415 remote_candidates->rem_controlvalue = random() * (0x7fffffffffffffff/0x7fff); 416 } 417 418 if (remote_candidates[0].rem_controlling==0 && msg.hasIceControlling) { 419 /* If the agent's tie-breaker is larger than or equal 420 to the contents of the ICE-CONTROLLING attribute 421 -> send 487, and do not change ROLE */ 422 if (remote_candidates->rem_controlvalue >= msg.iceControlling.value) { 423 char buf[STUN_MAX_MESSAGE_SIZE]; 424 int len = sizeof(buf); 425 ms_error("487 Role Conflict"); 426 _ice_createErrorResponse(&resp, 4, 87, "Role Conflict"); 427 len = stunEncodeMessage(&resp, buf, len, &hmacPassword ); 428 if (len) 429 sendMessage( rtp_socket, buf, len, remote_addr.addr, remote_addr.port); 430 return -1; 431 } 432 else { 433 remote_candidates[0].rem_controlling = 1; 434 } 435 } 436 437 if (remote_candidates[0].rem_controlling==1 && msg.hasIceControlled) { 438 439 /* If the agent's tie-breaker is larger than or equal 440 to the contents of the ICE-CONTROLLED attribute 441 -> change ROLE */ 442 if (remote_candidates->rem_controlvalue >= msg.iceControlled.value) { 443 remote_candidates[0].rem_controlling = 0; 444 } 445 else { 446 char buf[STUN_MAX_MESSAGE_SIZE]; 447 int len = sizeof(buf); 448 ms_error("487 Role Conflict"); 449 _ice_createErrorResponse(&resp, 4, 87, "Role Conflict"); 450 len = stunEncodeMessage(&resp, buf, len, &hmacPassword ); 451 if (len) 452 sendMessage( rtp_socket, buf, len, remote_addr.addr, remote_addr.port); 453 return -1; 454 } 455 } 430 456 431 457 /* 7.2.1.3. Learning Peer Reflexive Candidates */
Note: See TracChangeset
for help on using the changeset viewer.
