Bug 971357: Log STUN responses at INFO instead of DEBUG. r=ekr

--HG--
extra : rebase_source : 58291fe1ea5c807eff63982dfab4fe8f37289030
This commit is contained in:
Byron Campen [:bwc] 2014-02-11 17:27:45 -08:00
Родитель 190b768358
Коммит deed219594
1 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -444,6 +444,8 @@ int nr_stun_client_process_response(nr_stun_client_ctx *ctx, UCHAR *msg, int len
UCHAR hmac_key_d[16]; UCHAR hmac_key_d[16];
Data hmac_key; Data hmac_key;
int compute_lt_key=0; int compute_lt_key=0;
/* TODO(bcampen@mozilla.com): Bug 1023619, refactor this. */
int response_matched=0;
ATTACH_DATA(hmac_key, hmac_key_d); ATTACH_DATA(hmac_key, hmac_key_d);
@ -452,7 +454,7 @@ int nr_stun_client_process_response(nr_stun_client_ctx *ctx, UCHAR *msg, int len
if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING) if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING)
ABORT(R_REJECTED); ABORT(R_REJECTED);
r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Received check response (my_addr=%s,peer_addr=%s)",ctx->label,ctx->my_addr.as_string,peer_addr->as_string); r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Inspecting STUN response (my_addr=%s, peer_addr=%s)",ctx->label,ctx->my_addr.as_string,peer_addr->as_string);
snprintf(string, sizeof(string)-1, "STUN-CLIENT(%s): Received ", ctx->label); snprintf(string, sizeof(string)-1, "STUN-CLIENT(%s): Received ", ctx->label);
r_dump(NR_LOG_STUN, LOG_DEBUG, string, (char*)msg, len); r_dump(NR_LOG_STUN, LOG_DEBUG, string, (char*)msg, len);
@ -535,6 +537,7 @@ int nr_stun_client_process_response(nr_stun_client_ctx *ctx, UCHAR *msg, int len
nr_stun_message_destroy(&ctx->response); nr_stun_message_destroy(&ctx->response);
} }
/* TODO(bcampen@mozilla.com): Bug 1023619, refactor this. */
if ((r=nr_stun_message_create2(&ctx->response, msg, len))) if ((r=nr_stun_message_create2(&ctx->response, msg, len)))
ABORT(r); ABORT(r);
@ -546,12 +549,13 @@ int nr_stun_client_process_response(nr_stun_client_ctx *ctx, UCHAR *msg, int len
/* This will return an error if request and response don't match, /* This will return an error if request and response don't match,
which is how we reject responses that match other contexts. */ which is how we reject responses that match other contexts. */
if ((r=nr_stun_receive_message(ctx->request, ctx->response))) { if ((r=nr_stun_receive_message(ctx->request, ctx->response))) {
r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): error receiving response",ctx->label); r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-CLIENT(%s): Response is not for us",ctx->label);
ABORT(r); ABORT(r);
} }
r_log(NR_LOG_STUN,LOG_DEBUG, r_log(NR_LOG_STUN,LOG_INFO,
"STUN-CLIENT(%s): successfully received response; processing",ctx->label); "STUN-CLIENT(%s): Received response; processing",ctx->label);
response_matched=1;
/* TODO: !nn! currently using password!=0 to mean that auth is required, /* TODO: !nn! currently using password!=0 to mean that auth is required,
* TODO: !nn! but we should probably pass that in explicitly via the * TODO: !nn! but we should probably pass that in explicitly via the
@ -731,6 +735,10 @@ int nr_stun_client_process_response(nr_stun_client_ctx *ctx, UCHAR *msg, int len
_status=0; _status=0;
abort: abort:
if(_status && response_matched){
r_log(NR_LOG_STUN,LOG_WARNING,"STUN-CLIENT(%s): Error processing response: %s, stun error code %d.", ctx->label, nr_strerror(_status), (int)ctx->error_code);
}
if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING) { if (ctx->state != NR_STUN_CLIENT_STATE_RUNNING) {
/* Cancel the timer firing */ /* Cancel the timer firing */
if (ctx->timer_handle) { if (ctx->timer_handle) {