Bug 1142964 - Fix ICE tiebreaker on Windows. r=bwc

This commit is contained in:
Nils Ohlmeier [:drno] 2015-08-21 10:35:28 -07:00
parent 273696f653
commit 5bfe29f992
7 changed files with 10 additions and 16 deletions

View File

@ -125,7 +125,7 @@ int nr_ice_candidate_pair_create(nr_ice_peer_ctx *pctx, nr_ice_candidate *lcand,
/* TODO(ekr@rtfm.com): Do we need to frob this when we change role. Bug 890667 */
pair->stun_client->params.ice_binding_request.control = pctx->controlling?
NR_ICE_CONTROLLING:NR_ICE_CONTROLLED;
pair->stun_client->params.ice_use_candidate.priority=t_priority;
pair->stun_client->params.ice_binding_request.priority=t_priority;
pair->stun_client->params.ice_binding_request.tiebreaker=pctx->tiebreaker;

View File

@ -750,7 +750,7 @@ static int nr_ice_component_process_incoming_check(nr_ice_component *comp, nr_tr
/* OK, there is a conflict. Who's right? */
r_log(LOG_ICE,LOG_INFO,"ICE-PEER(%s): role conflict, both controlled",comp->stream->pctx->label);
if(attr->u.ice_controlling < comp->stream->pctx->tiebreaker){
if(attr->u.ice_controlled < comp->stream->pctx->tiebreaker){
/* Update the peer ctx. This will propagate to all candidate pairs
in the context. */
nr_ice_peer_ctx_switch_controlling_role(comp->stream->pctx);

View File

@ -219,7 +219,7 @@ nr_stun_build_req_stund_0_96(nr_stun_client_stun_binding_request_stund_0_96_para
#ifdef USE_ICE
int
nr_stun_build_use_candidate(nr_stun_client_ice_use_candidate_params *params, nr_stun_message **msg)
nr_stun_build_use_candidate(nr_stun_client_ice_binding_request_params *params, nr_stun_message **msg)
{
int r,_status;
nr_stun_message *req = 0;

View File

@ -76,16 +76,6 @@ int nr_stun_build_req_stund_0_96(nr_stun_client_stun_binding_request_stund_0_96_
#ifdef USE_ICE
typedef struct nr_stun_client_ice_use_candidate_params_ {
char *username;
Data password;
UINT4 priority;
UINT8 tiebreaker;
} nr_stun_client_ice_use_candidate_params;
int nr_stun_build_use_candidate(nr_stun_client_ice_use_candidate_params *params, nr_stun_message **msg);
typedef struct nr_stun_client_ice_binding_request_params_ {
char *username;
Data password;
@ -96,6 +86,8 @@ typedef struct nr_stun_client_ice_binding_request_params_ {
UINT8 tiebreaker;
} nr_stun_client_ice_binding_request_params;
int nr_stun_build_use_candidate(nr_stun_client_ice_binding_request_params *params, nr_stun_message **msg);
int nr_stun_build_req_ice(nr_stun_client_ice_binding_request_params *params, nr_stun_message **msg);
#endif /* USE_ICE */

View File

@ -337,7 +337,7 @@ static int nr_stun_client_send_request(nr_stun_client_ctx *ctx)
#ifdef USE_ICE
case NR_ICE_CLIENT_MODE_USE_CANDIDATE:
if ((r=nr_stun_build_use_candidate(&ctx->params.ice_use_candidate, &ctx->request)))
if ((r=nr_stun_build_use_candidate(&ctx->params.ice_binding_request, &ctx->request)))
ABORT(r);
break;
case NR_ICE_CLIENT_MODE_BINDING_REQUEST:

View File

@ -65,7 +65,6 @@ typedef union nr_stun_client_params_ {
#endif /* USE_STUND_0_96 */
#ifdef USE_ICE
nr_stun_client_ice_use_candidate_params ice_use_candidate;
nr_stun_client_ice_binding_request_params ice_binding_request;
#endif /* USE_ICE */

View File

@ -1322,7 +1322,7 @@ nr_stun_encode_message(nr_stun_message *msg)
ABORT(R_INTERNAL);
}
attr_info->name = attr_info->name;
attr->name = attr_info->name;
attr->type_name = attr_info->codec->name;
attr->encoding = (nr_stun_encoded_attribute*)&msg->buffer[msg->length];
@ -1355,6 +1355,9 @@ nr_stun_encode_message(nr_stun_message *msg)
length_offset = length_offset_hold;
(void)nr_stun_encode_htons(msg->header.length, sizeof(msg->buffer), msg->buffer, &length_offset);
}
else {
r_log(NR_LOG_STUN, LOG_WARNING, "Missing encode function for attribute: %s", attr_info->name);
}
}
r_log(NR_LOG_STUN, LOG_DEBUG, "Encoded Length: %d", msg->header.length);