Bug 980609: Do not assert that TURN TCP client contexts can't fail before attempting to allocate. r=ekr
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 07 Mar 2014 15:29:09 -0800
changeset 251045 26c012160bbce06fb3ac94d74cf1ba548e8c4b0b
parent 251044 740bf479671abb7b199b47c30032f7e917ea7a52
child 251046 fe62ee3d6de16f63fb58fa74733666791d23a663
push id28980
push usercbook@mozilla.com
push dateThu, 02 Jul 2015 13:44:32 +0000
treeherdermozilla-central@f1b3144fed94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr
bugs980609
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 980609: Do not assert that TURN TCP client contexts can't fail before attempting to allocate. r=ekr
media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
--- a/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/stun/turn_client_ctx.c
@@ -612,16 +612,27 @@ static void nr_turn_client_permission_er
 }
 
 int nr_turn_client_allocate(nr_turn_client_ctx *ctx,
                             NR_async_cb finished_cb, void *cb_arg)
 {
   nr_turn_stun_ctx *stun = 0;
   int r,_status;
 
+  if(ctx->state == NR_TURN_CLIENT_STATE_FAILED ||
+     ctx->state == NR_TURN_CLIENT_STATE_CANCELLED){
+    /* TURN TCP contexts can fail before we ever try to form an allocation,
+     * since the TCP connection can fail. It is also conceivable that a TURN
+     * TCP context could be cancelled before we are done forming all
+     * allocations (although we do not do this at the time this code was
+     * written) */
+    assert(ctx->turn_server_addr.protocol == IPPROTO_TCP);
+    ABORT(R_NOT_FOUND);
+  }
+
   assert(ctx->state == NR_TURN_CLIENT_STATE_INITTED);
 
   ctx->finished_cb=finished_cb;
   ctx->cb_arg=cb_arg;
 
   if ((r=nr_turn_stun_ctx_create(ctx, NR_TURN_CLIENT_MODE_ALLOCATE_REQUEST,
                                  nr_turn_client_allocate_cb,
                                  nr_turn_client_error_cb,