Bug 1293206 - Cancel TCP connect callback after connect. r=bwc, a=lizzard
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Mon, 15 Aug 2016 10:39:00 -0400
changeset 342364 18420a62cca834f2bbb4786e2c2194826885f62a
parent 342363 a7ef4e7277b4f9d3a1fdf96a5c62c07745c06e73
child 342365 36cdcd06bf6f2fa49e5f097ad0fbef0f9630ae84
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc, lizzard
bugs1293206
milestone49.0
Bug 1293206 - Cancel TCP connect callback after connect. r=bwc, a=lizzard
media/mtransport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c
--- a/media/mtransport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c
+++ b/media/mtransport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c
@@ -400,24 +400,38 @@ static int nr_socket_buffered_stun_accep
   nr_socket_buffered_stun *bsock = (nr_socket_buffered_stun *)obj;
 
   return nr_socket_accept(bsock->inner, addrp, sockp);
 }
 
 static void nr_socket_buffered_stun_connected_cb(NR_SOCKET s, int how, void *arg)
 {
   nr_socket_buffered_stun *sock = (nr_socket_buffered_stun *)arg;
+  int r, _status;
+  NR_SOCKET fd;
 
   assert(!sock->connected);
 
   sock->connected = 1;
+
+  if ((r=nr_socket_getfd(sock->inner, &fd)))
+    ABORT(r);
+  NR_ASYNC_CANCEL(fd, NR_ASYNC_WAIT_WRITE);
+
   if (sock->pending) {
     r_log(LOG_GENERIC, LOG_INFO, "Invoking writable_cb on connected (%u)", (uint32_t) sock->pending);
     nr_socket_buffered_stun_writable_cb(s, how, arg);
   }
+
+  _status=0;
+abort:
+  if (_status) {
+    r_log(LOG_GENERIC, LOG_ERR, "Failure in nr_socket_buffered_stun_connected_cb: %d", _status);
+
+  }
 }
 
 static int nr_socket_buffered_stun_connect(void *obj, nr_transport_addr *addr)
 {
   nr_socket_buffered_stun *sock = (nr_socket_buffered_stun *)obj;
   int r, _status;
 
   if ((r=nr_transport_addr_copy(&sock->remote_addr, addr)))