<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[211830] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/211830">211830</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-07 12:19:09 -0800 (Tue, 07 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
https://bugs.webkit.org/show_bug.cgi?id=167939

Patch by Youenn Fablet &lt;youennf@gmail.com&gt; on 2017-02-07
Reviewed by Sam Weinig.

Source/WebCore:

Test: webrtc/no-port-zero-in-upd-candidates.html

* testing/MockLibWebRTCPeerConnection.cpp:
(WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment.

Source/WebKit2:

AddressReady signalling was done by the WebProcess for UDP and ServerTCP as real async sockets in those case do
not send it. But the WebProcess does not have information on the port, as it is assigned by the socket factory
which is in the network process.

Fixed that bug by signalling AddressReady in the network process for UDP, ServerTCP and ClientTCP.

* NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
(WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
(WebKit::LibWebRTCSocketClient::signalAddressReady):
* NetworkProcess/webrtc/LibWebRTCSocketClient.h:
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createUDPSocket):
(WebKit::NetworkRTCProvider::createServerTCPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
(WebKit::LibWebRTCSocket::LibWebRTCSocket):
(WebKit::LibWebRTCSocket::signalAddressReady):

LayoutTests:

* webrtc/no-port-zero-in-upd-candidates.html: Added.
* webrtc/no-port-zero-in-upd-candidates-expected.txt: Added.
* webrtc/video.html:
* webrtc/video-expected.txt: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestswebrtcvideohtml">trunk/LayoutTests/webrtc/video.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoretestingMockLibWebRTCPeerConnectioncpp">trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesswebrtcLibWebRTCSocketClientcpp">trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesswebrtcLibWebRTCSocketClienth">trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesswebrtcNetworkRTCProvidercpp">trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkwebrtcLibWebRTCSocketcpp">trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkwebrtcLibWebRTCSocketh">trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestswebrtcnoportzeroinupdcandidatesexpectedtxt">trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebrtcnoportzeroinupdcandidateshtml">trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html</a></li>
<li><a href="#trunkLayoutTestswebrtcvideoexpectedtxt">trunk/LayoutTests/webrtc/video-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/LayoutTests/ChangeLog        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-02-07  Youenn Fablet  &lt;youennf@gmail.com&gt;
+
+        [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+        https://bugs.webkit.org/show_bug.cgi?id=167939
+
+        Reviewed by Sam Weinig.
+
+        * webrtc/no-port-zero-in-upd-candidates.html: Added.
+        * webrtc/no-port-zero-in-upd-candidates-expected.txt: Added.
+        * webrtc/video.html:
+        * webrtc/video-expected.txt: Added.
+
</ins><span class="cx"> 2017-02-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, manual roll out of r211777
</span></span></pre></div>
<a id="trunkLayoutTestswebrtcnoportzeroinupdcandidatesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt (0 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt                                (rev 0)
+++ trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Checking UDP ICE candidate ports 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebrtcnoportzeroinupdcandidateshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html (0 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html                                (rev 0)
+++ trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta charset=&quot;utf-8&quot;&gt;
+        &lt;title&gt;Ensuring ICE UDP candidates have a valid port&lt;/title&gt;
+        &lt;script src=&quot;../resources/testharness.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script&gt;
+
+if (window.internals)
+    internals.useMockRTCPeerConnectionFactory(&quot;OneRealPeerConnection&quot;);
+
+function gatherCandidates(pc)
+{
+    var candidates = [];
+    return new Promise((resolve, reject) =&gt; {
+        pc.onicecandidate = (event) =&gt; {
+            if (event.candidate === null) {
+                resolve(candidates);
+                return;
+            }
+            candidates.push(event.candidate.candidate);
+        };
+        pc.createOffer().then((offer) =&gt; {
+            pc.setLocalDescription(offer);
+        });
+    });
+}
+
+promise_test((test) =&gt; {
+    var pc = new RTCPeerConnection();
+    pc.createDataChannel(&quot;&quot;);
+
+    var hasCandidate = false;
+    return gatherCandidates(pc).then((candidates) =&gt; {
+        for(candidate of candidates) {
+            if (candidate.toLowerCase().indexOf(&quot; udp &quot;) === -1)
+                continue;
+            items = candidate.split(&quot; &quot;);
+            var port = parseInt(items[5]);
+            assert_true(port &gt; 1024, &quot;port is expected to be above 1024 but was &quot; + port);
+            hasCandidate = true;
+        }
+        assert_true(hasCandidate, &quot;Candidates should be gathered&quot;);
+    });
+}, &quot;Checking UDP ICE candidate ports&quot;);
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestswebrtcvideoexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webrtc/video-expected.txt (0 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webrtc/video-expected.txt                                (rev 0)
+++ trunk/LayoutTests/webrtc/video-expected.txt        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+
+PASS Basic video exchange 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebrtcvideohtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webrtc/video.html (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webrtc/video.html        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/LayoutTests/webrtc/video.html        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> &lt;html&gt;
</span><span class="cx">     &lt;head&gt;
</span><span class="cx">         &lt;meta charset=&quot;utf-8&quot;&gt;
</span><del>-        &lt;title&gt;Testing basic data channel from offerer to receiver&lt;/title&gt;
</del><ins>+        &lt;title&gt;Testing basic video exchange from offerer to receiver&lt;/title&gt;
</ins><span class="cx">         &lt;script src=&quot;../resources/testharness.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">         &lt;script src=&quot;../resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;/head&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebCore/ChangeLog        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-02-07  Youenn Fablet  &lt;youennf@gmail.com&gt;
+
+        [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+        https://bugs.webkit.org/show_bug.cgi?id=167939
+
+        Reviewed by Sam Weinig.
+
+        Test: webrtc/no-port-zero-in-upd-candidates.html
+
+        * testing/MockLibWebRTCPeerConnection.cpp:
+        (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment.
+
</ins><span class="cx"> 2017-02-07  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Update bindings tests results for additional include.
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockLibWebRTCPeerConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -92,8 +92,12 @@
</span><span class="cx">     : m_provider(provider)
</span><span class="cx">     , m_testCase(WTFMove(testCase))
</span><span class="cx"> {
</span><del>-    if (m_testCase == &quot;TwoRealPeerConnections&quot; &amp;&amp; m_provider)
</del><ins>+    if (m_testCase == &quot;TwoRealPeerConnections&quot; &amp;&amp; m_provider) {
</ins><span class="cx">         m_numberOfRealPeerConnections = 2;
</span><ins>+        return;
+    }
+    if (m_testCase == &quot;OneRealPeerConnection&quot; &amp;&amp; m_provider)
+        m_numberOfRealPeerConnections = 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> rtc::scoped_refptr&lt;webrtc::PeerConnectionInterface&gt; MockLibWebRTCPeerConnectionFactory::CreatePeerConnection(const webrtc::PeerConnectionInterface::RTCConfiguration&amp;, std::unique_ptr&lt;cricket::PortAllocator&gt;, std::unique_ptr&lt;rtc::RTCCertificateGeneratorInterface&gt;, webrtc::PeerConnectionObserver* observer)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2017-02-07  Youenn Fablet  &lt;youennf@gmail.com&gt;
+
+        [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+        https://bugs.webkit.org/show_bug.cgi?id=167939
+
+        Reviewed by Sam Weinig.
+
+        AddressReady signalling was done by the WebProcess for UDP and ServerTCP as real async sockets in those case do
+        not send it. But the WebProcess does not have information on the port, as it is assigned by the socket factory
+        which is in the network process.
+
+        Fixed that bug by signalling AddressReady in the network process for UDP, ServerTCP and ClientTCP.
+
+        * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
+        (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
+        (WebKit::LibWebRTCSocketClient::signalAddressReady):
+        * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
+        * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+        (WebKit::NetworkRTCProvider::createUDPSocket):
+        (WebKit::NetworkRTCProvider::createServerTCPSocket):
+        (WebKit::NetworkRTCProvider::createClientTCPSocket):
+        * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
+        (WebKit::LibWebRTCSocket::LibWebRTCSocket):
+        (WebKit::LibWebRTCSocket::signalAddressReady):
+
</ins><span class="cx"> 2017-02-07  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Try to fix the EFL build.
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesswebrtcLibWebRTCSocketClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-LibWebRTCSocketClient::LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&amp; rtcProvider, std::unique_ptr&lt;rtc::AsyncPacketSocket&gt;&amp;&amp; socket)
</del><ins>+LibWebRTCSocketClient::LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&amp; rtcProvider, std::unique_ptr&lt;rtc::AsyncPacketSocket&gt;&amp;&amp; socket, Type type)
</ins><span class="cx">     : m_identifier(identifier)
</span><span class="cx">     , m_rtcProvider(rtcProvider)
</span><span class="cx">     , m_socket(WTFMove(socket))
</span><span class="lines">@@ -51,9 +51,14 @@
</span><span class="cx"> 
</span><span class="cx">     m_socket-&gt;SignalReadPacket.connect(this, &amp;LibWebRTCSocketClient::signalReadPacket);
</span><span class="cx">     m_socket-&gt;SignalSentPacket.connect(this, &amp;LibWebRTCSocketClient::signalSentPacket);
</span><del>-    m_socket-&gt;SignalAddressReady.connect(this, &amp;LibWebRTCSocketClient::signalAddressReady);
</del><span class="cx">     m_socket-&gt;SignalConnect.connect(this, &amp;LibWebRTCSocketClient::signalConnect);
</span><span class="cx">     m_socket-&gt;SignalClose.connect(this, &amp;LibWebRTCSocketClient::signalClose);
</span><ins>+
+    if (type == Type::ClientTCP) {
+        m_socket-&gt;SignalAddressReady.connect(this, &amp;LibWebRTCSocketClient::signalAddressReady);
+        return;
+    }
+    signalAddressReady();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LibWebRTCSocketClient::sendTo(const WebCore::SharedBuffer&amp; buffer, const rtc::SocketAddress&amp; socketAddress, const rtc::PacketOptions&amp; options)
</span><span class="lines">@@ -98,6 +103,11 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void LibWebRTCSocketClient::signalAddressReady()
+{
+    signalAddressReady(m_socket.get(), m_socket-&gt;GetLocalAddress());
+}
+
</ins><span class="cx"> void LibWebRTCSocketClient::signalConnect(rtc::AsyncPacketSocket*)
</span><span class="cx"> {
</span><span class="cx">     m_rtcProvider.sendFromMainThread([identifier = m_identifier](IPC::Connection&amp; connection) {
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesswebrtcLibWebRTCSocketClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -49,8 +49,10 @@
</span><span class="cx"> 
</span><span class="cx"> class LibWebRTCSocketClient final : public sigslot::has_slots&lt;&gt; {
</span><span class="cx"> public:
</span><del>-    LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&amp;, std::unique_ptr&lt;rtc::AsyncPacketSocket&gt;&amp;&amp;);
</del><ins>+    enum class Type { UDP, ServerTCP, ClientTCP };
</ins><span class="cx"> 
</span><ins>+    LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&amp;, std::unique_ptr&lt;rtc::AsyncPacketSocket&gt;&amp;&amp;, Type);
+
</ins><span class="cx"> private:
</span><span class="cx">     friend class NetworkRTCSocket;
</span><span class="cx"> 
</span><span class="lines">@@ -64,6 +66,8 @@
</span><span class="cx">     void signalConnect(rtc::AsyncPacketSocket*);
</span><span class="cx">     void signalClose(rtc::AsyncPacketSocket*, int);
</span><span class="cx"> 
</span><ins>+    void signalAddressReady();
+
</ins><span class="cx">     uint64_t m_identifier;
</span><span class="cx">     NetworkRTCProvider&amp; m_rtcProvider;
</span><span class="cx">     std::unique_ptr&lt;rtc::AsyncPacketSocket&gt; m_socket;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesswebrtcNetworkRTCProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">     callOnRTCNetworkThread([this, identifier, socketAddress, minPort, maxPort]() {
</span><span class="cx">         std::unique_ptr&lt;rtc::AsyncPacketSocket&gt; socket(m_packetSocketFactory-&gt;CreateUdpSocket(socketAddress, minPort, maxPort));
</span><del>-        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket)));
</del><ins>+        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::UDP));
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> 
</span><span class="cx">     callOnRTCNetworkThread([this, identifier, socketAddress, minPort, maxPort, options]() {
</span><span class="cx">         std::unique_ptr&lt;rtc::AsyncPacketSocket&gt; socket(m_packetSocketFactory-&gt;CreateServerTcpSocket(socketAddress, minPort, maxPort, options));
</span><del>-        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket)));
</del><ins>+        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::ServerTCP));
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> 
</span><span class="cx">     callOnRTCNetworkThread([this, identifier, socketLocalAddress, socketRemoteAddress, options]() {
</span><span class="cx">         std::unique_ptr&lt;rtc::AsyncPacketSocket&gt; socket(m_packetSocketFactory-&gt;CreateClientTcpSocket(socketLocalAddress, socketRemoteAddress, { }, { }, options));
</span><del>-        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket)));
</del><ins>+        addSocket(identifier, std::make_unique&lt;LibWebRTCSocketClient&gt;(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::ClientTCP));
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkwebrtcLibWebRTCSocketcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -54,13 +54,6 @@
</span><span class="cx">     , m_remoteAddress(remoteAddress)
</span><span class="cx"> {
</span><span class="cx">     memset(&amp;m_options, 1, MAX_SOCKET_OPTION);
</span><del>-
-    if (type == Type::ClientTCP)
-        return;
-
-    WebRTCSocket::signalOnNetworkThread(m_factory, m_identifier, [](LibWebRTCSocket&amp; socket) {
-        socket.signalAddressReady();
-    });
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LibWebRTCSocket::~LibWebRTCSocket()
</span><span class="lines">@@ -78,18 +71,10 @@
</span><span class="cx">     return m_remoteAddress;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void LibWebRTCSocket::signalAddressReady()
-{
-    ASSERT(m_type != Type::ClientTCP);
-    m_state = STATE_BOUND;
-    SignalAddressReady(this, m_localAddress);
-}
-
</del><span class="cx"> void LibWebRTCSocket::signalAddressReady(const String&amp; address)
</span><span class="cx"> {
</span><del>-    ASSERT(m_type == Type::ClientTCP);
</del><span class="cx">     m_localAddress.FromString(address.utf8().data());
</span><del>-    m_state = STATE_CONNECTED;
</del><ins>+    m_state = (m_type == Type::ClientTCP) ? STATE_CONNECTED : STATE_BOUND;
</ins><span class="cx">     SignalAddressReady(this, m_localAddress);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkwebrtcLibWebRTCSocketh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h (211829 => 211830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h        2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h        2017-02-07 20:19:09 UTC (rev 211830)
</span><span class="lines">@@ -68,7 +68,6 @@
</span><span class="cx">     void signalReadPacket(const WebCore::SharedBuffer&amp;, rtc::SocketAddress&amp;&amp;, int64_t);
</span><span class="cx">     void signalSentPacket(int, int64_t);
</span><span class="cx">     void signalAddressReady(const String&amp;);
</span><del>-    void signalAddressReady();
</del><span class="cx">     void signalConnect();
</span><span class="cx">     void signalClose(int);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>