Bug 837421: Webrtc: Ignore second call to ConnectDataConnection r=derf
authorRandell Jesup <rjesup@jesup.org>
Sun, 03 Feb 2013 00:29:04 -0500
changeset 120693 b10cbe334217969b0fbd5b9fdf4e7a67d0808c32
parent 120692 6472bf8f484b82320ff4a3338a81b8460492d222
child 120694 eae4b34eb792efd0b33b06313fa9dda3c12166c6
push id24261
push userphilringnalda@gmail.com
push dateSun, 03 Feb 2013 20:34:26 +0000
treeherdermozilla-central@847e28c7ba67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersderf
bugs837421
milestone21.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 837421: Webrtc: Ignore second call to ConnectDataConnection r=derf
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -616,18 +616,24 @@ PeerConnectionImpl::CreateFakeMediaStrea
 NS_IMETHODIMP
 PeerConnectionImpl::ConnectDataConnection(uint16_t aLocalport,
                                           uint16_t aRemoteport,
                                           uint16_t aNumstreams)
 {
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
 
 #ifdef MOZILLA_INTERNAL_API
+  if (mDataConnection) {
+    CSFLogError(logTag,"%s DataConnection already connected",__FUNCTION__);
+    // Ignore the request to connect when already connected.  This entire
+    // implementation is temporary.  Ignore aNumstreams as it's merely advisory
+    // and we increase the number of streams dynamically as needed.
+    return NS_OK;
+  }
   mDataConnection = new mozilla::DataChannelConnection(this);
-  NS_ENSURE_TRUE(mDataConnection,NS_ERROR_FAILURE);
   if (!mDataConnection->Init(aLocalport, aNumstreams, true)) {
     CSFLogError(logTag,"%s DataConnection Init Failed",__FUNCTION__);
     return NS_ERROR_FAILURE;
   }
   // XXX Fix! Get the correct flow for DataChannel. Also error handling.
   for (int i = 2; i >= 0; i--) {
     nsRefPtr<TransportFlow> flow = mMedia->GetTransportFlow(i,false).get();
     CSFLogDebugS(logTag, "Transportflow[" << i << "] = " << flow.get());