96 Commits

Author SHA1 Message Date
honghaiz
e58d73d23e Fix more swarming test failures by using the fake clock or longer timeout.
In the swarming test, the machines sometimes were blocked for 1-2 seconds without processing anything.
This CL makes sure that 1 second timeout is only used with fake clock.

BUG=webrtc:6500

Review-Url: https://codereview.webrtc.org/2442813002
Cr-Commit-Position: refs/heads/master@{#14756}
2016-10-24 23:38:31 +00:00
deadbeef
dd7fb43f28 Emit SignalReadyToSend even for "presumed writable" connections.
The Connection class will now blindly forward SignalReadyToSend, and
P2PTransportChannel will decide whether to forward it further (which
it was already doing).

BUG=webrtc:6448

Review-Url: https://codereview.webrtc.org/2374183005
Cr-Commit-Position: refs/heads/master@{#14462}
2016-09-30 22:16:57 +00:00
Honghai Zhang
4cedf2b78c Add signaling to support ICE renomination.
By default, this will tell the remote side that I am supporting ICE renomination.
It does not use ICE renomination yet even if the remote side supports it.

R=deadbeef@webrtc.org, pthatcher@webrtc.org, skvlad@webrtc.org

Review URL: https://codereview.webrtc.org/2224563004 .

Cr-Commit-Position: refs/heads/master@{#13998}
2016-08-31 15:18:22 +00:00
Taylor Brandstetter
62351c9923 Fixing problems with ICE candidate pair prioritization.
The main issue was that upon receiving a binding response with a srflx
mapped address attribute, the local candidate was not updated from local
to srflx. This means the two ICE agents view the same pair differently;
one sees it as "X<->srflx" while the other sees it as "local<->X". This
causes sub-optimal prioritization and could result in the wrong pair
being selected if using aggressive nomination.

The other issue was that TCP prflx candidates were not differentiated from
UDP prflx candidates. This lead to TCP prflx candidates prioritized above TCP
host candidates.

After fixing these issues, I was able to re-enable many disabled tests, as well
as restore the check for the candidate types of the controlled agent.

BUG=webrtc:1953,webrtc:2383
R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2125823004 .

Cr-Commit-Position: refs/heads/master@{#13734}
2016-08-11 23:05:15 +00:00
Honghai Zhang
8cd8f81748 Prepare for ICE renomination.
Add an ICE nomination attribute. If a connection switched on the controlling side, increase the nomination value set in the attribute.
The controlled side will also be ready for re-nomination option; it will switch if a nomination comes with a higher nomination value even though it may be at a lower priority.
Plus, don't nominate or re-nominate if the nomination value at the current connection has been acknowledged.

BUG=
R=deadbeef@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2163403002 .

Cr-Commit-Position: refs/heads/master@{#13631}
2016-08-04 02:50:53 +00:00
Honghai Zhang
a74363c998 Remove ports that are not used by any channel after timeout
If a port is not used by any channel and if it has no connection for 30
seconds, it will be removed.
Note, as long as a port is used by a transport channel, it will be kept
even if it does not have any connection. This will be beneficial to
continual gathering because new connections can be created in the future
when network changes.

BUG=
R=pthatcher@webrtc.org, zhihuang@webrtc.org

Review URL: https://codereview.webrtc.org/2171183002 .

Cr-Commit-Position: refs/heads/master@{#13567}
2016-07-29 01:06:26 +00:00
Honghai Zhang
b5db1ec0e5 Delay destroying a port if new connections are created and destroyed.
If all connections on a port is destroyed, it will schedule an event
to check if it is dead after a timeout. Previously if a new connection
is created but destroyed before the event is fired, it will destroy the
port. With this change, we will not destoy it until it times out again
after the last created connection is destroyed.

BUG=
R=pthatcher@webrtc.org, zhihuang@webrtc.org

Review URL: https://codereview.webrtc.org/2184013003 .

Cr-Commit-Position: refs/heads/master@{#13563}
2016-07-28 20:23:13 +00:00
honghaiz
9ad0db51a6 Dampening connection switch.
If the currently selected connection becomes not receiving and if a backup connection
becomes strong first, we will not switch the connection until X milliseconds is passed
but the selected connection is still not receiving and the backup connection is still receiving. This will prevent the connection switching from happening too frequently.

BUG=

Review-Url: https://codereview.webrtc.org/2143653005
Cr-Commit-Position: refs/heads/master@{#13480}
2016-07-15 02:30:32 +00:00
Honghai Zhang
5622c5eae5 If continual gathering is enabled,
we will periodically check if any network does not have any connection on it and if yes, attempt to re-gather on those networks.

BUG=
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2025573002 .

Cr-Commit-Position: refs/heads/master@{#13367}
2016-07-01 20:59:39 +00:00
Taylor Brandstetter
b825aee04a Start ICE connectivity checks as soon as the first pair is pingable.
Previously, we were starting a periodic timer when the local
description was set. The first connection may be created at any
time after this happens, so after creating the first connection, we
need to wait until that timer next fires before sending a ping.

Now we just start that timer (and send the first ping) immediately
after the first connection becomes pingable.

This CL also removes the "Connect" method. The only vestigal
effect of this method was to start the periodic timer, which is
now not needed since it happens automatically.

R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2099563004 .

Cr-Commit-Position: refs/heads/master@{#13331}
2016-06-29 20:07:26 +00:00
Honghai Zhang
d00c05788f Fix the turn and udp port type.
The port type was not set if it was created on a shared socket.

BUG=
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2099023002 .

Cr-Commit-Position: refs/heads/master@{#13313}
2016-06-28 16:44:55 +00:00
Taylor Brandstetter
6bb1ef2b86 Fixing bug where Connection drops packets when presumed writable.
The "should I simulate EWOULDBLOCK?" determination now happens
solely in P2PTransportChannel. This also fixes a bug where the
"last packet id" was set even if no packet was sent.

R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2099783002 .

Cr-Commit-Position: refs/heads/master@{#13307}
2016-06-28 01:09:10 +00:00
honghaiz
059e183419 Reland of "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #1 id:1 of https://codereview.webrtc.org/2098703004/ )
Reason for revert:
It turns out this revert was not necessary because the connection-state mapping for turn-turn connections was not done in connection.

Original issue's description:
> Revert of Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #5 id:120001 of https://codereview.webrtc.org/2041593002/ )
>
> Reason for revert:
> ReadyToSendMedia did not consider the new presumed_writable state.
>
> Original issue's description:
> > Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://codereview.webrtc.org/2000063003/ )"
> >
> > This reverts commit 72d41aa6da94dacb8a8464d1abd4ca7d1afffc65.
> >
> > New change made:
> > Do not reset the BWE when the new network route is not ready to send media.
> >
> > BUG=
> > R=pthatcher@webrtc.org, stefan@webrtc.org
> >

TBR=pthatcher@webrtc.org,stefan@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2094863003
Cr-Commit-Position: refs/heads/master@{#13282}
2016-06-24 18:04:00 +00:00
honghaiz
ae4d0d922b Revert of Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #5 id:120001 of https://codereview.webrtc.org/2041593002/ )
Reason for revert:
ReadyToSendMedia did not consider the new presumed_writable state.

Original issue's description:
> Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://codereview.webrtc.org/2000063003/ )"
>
> This reverts commit 72d41aa6da94dacb8a8464d1abd4ca7d1afffc65.
>
> New change made:
> Do not reset the BWE when the new network route is not ready to send media.
>
> BUG=
> R=pthatcher@webrtc.org, stefan@webrtc.org
>
> Committed: https://crrev.com/5b5d2cdad7018993272525a723ef34f7da5c45f2
> Cr-Commit-Position: refs/heads/master@{#13280}

TBR=pthatcher@webrtc.org,stefan@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2098703004
Cr-Commit-Position: refs/heads/master@{#13281}
2016-06-24 17:06:25 +00:00
Honghai Zhang
5b5d2cdad7 Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://codereview.webrtc.org/2000063003/ )"
This reverts commit 72d41aa6da94dacb8a8464d1abd4ca7d1afffc65.

New change made:
Do not reset the BWE when the new network route is not ready to send media.

BUG=
R=pthatcher@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2041593002 .

Cr-Commit-Position: refs/heads/master@{#13280}
2016-06-24 17:01:01 +00:00
honghaiz
079a7a197f Reland of Do not delete a connection in the turn port with permission error or refresh error. (patchset #1 id:1 of https://codereview.webrtc.org/2090833002/ )
Reason for revert:
The Webrtc waterfall indicates that this revert is not necessary.

Original issue's description:
> Revert of Do not delete a connection in the turn port with permission error or refresh error. (patchset #6 id:260001 of https://codereview.webrtc.org/2068263003/ )
>
> Reason for revert:
> It broke webrtc builds.
>
> Original issue's description:
> > Do not delete a connection in the turn port with permission error,  refresh error, or binding error.
> >
> > Even if those error happened, the connection may still be able to receive packets for a while.
> > If we delete the connections, all packets arriving will be dropped.
> >
> > BUG=webrtc:6007
> > R=deadbeef@webrtc.org, pthatcher@webrtc.org
> >
> > Committed: https://crrev.com/3d77deb29c15bfb8f794ef3413837a0ec0f0c131
> > Cr-Commit-Position: refs/heads/master@{#13262}
>
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> TBR=pthatcher@webrtc.org,deadbeef@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:6007
>
> Committed: https://crrev.com/3159ffae6b1d5cba2ad972bd3d8074ac85f2c7f9
> Cr-Commit-Position: refs/heads/master@{#13265}

TBR=pthatcher@webrtc.org,deadbeef@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6007

Review-Url: https://codereview.webrtc.org/2090073003
Cr-Commit-Position: refs/heads/master@{#13266}
2016-06-22 23:27:08 +00:00
honghaiz
3159ffae6b Revert of Do not delete a connection in the turn port with permission error or refresh error. (patchset #6 id:260001 of https://codereview.webrtc.org/2068263003/ )
Reason for revert:
It broke webrtc builds.

Original issue's description:
> Do not delete a connection in the turn port with permission error,  refresh error, or binding error.
>
> Even if those error happened, the connection may still be able to receive packets for a while.
> If we delete the connections, all packets arriving will be dropped.
>
> BUG=webrtc:6007
> R=deadbeef@webrtc.org, pthatcher@webrtc.org
>
> Committed: https://crrev.com/3d77deb29c15bfb8f794ef3413837a0ec0f0c131
> Cr-Commit-Position: refs/heads/master@{#13262}

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=pthatcher@webrtc.org,deadbeef@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:6007

Review-Url: https://codereview.webrtc.org/2090833002
Cr-Commit-Position: refs/heads/master@{#13265}
2016-06-22 23:18:37 +00:00
Honghai Zhang
3d77deb29c Do not delete a connection in the turn port with permission error, refresh error, or binding error.
Even if those error happened, the connection may still be able to receive packets for a while.
If we delete the connections, all packets arriving will be dropped.

BUG=webrtc:6007
R=deadbeef@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2068263003 .

Cr-Commit-Position: refs/heads/master@{#13262}
2016-06-22 23:01:55 +00:00
Taylor Brandstetter
f7c15a9159 Set the generation on peer reflexive candidates when created.
If an actual peer reflexive candidate was created (and not one that
would just be replaced by a different candidate later), we weren't
setting the generation value. This means that new-generation prflx
candidate pairs weren't being prioritized above the cross-generation
pairs, or above relay<->relay pairs.

R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2086793002 .

Cr-Commit-Position: refs/heads/master@{#13259}
2016-06-22 20:14:18 +00:00
zhihuang
435264a183 Increase the stun ping interval.
Writable connections are pinged at a slower rate.
The function IsPingable will filter out the writable connections.
The interval for slower ping rate by default is WRITABLE_CONNECTION_PING_INTERVAL(2500ms) and can be set with the configuration.

BUG=webrtc:1161

Committed: https://crrev.com/8f7a5aad55a64f0d81b6436a22ffbdfcdcde91e0
Review-Url: https://codereview.webrtc.org/1944003002
Cr-Original-Commit-Position: refs/heads/master@{#12736}
Cr-Commit-Position: refs/heads/master@{#13241}
2016-06-21 18:28:49 +00:00
Taylor Brandstetter
5d97a9a05b Adding more detail to MessageQueue::Dispatch logging.
Every message will now be traced with the location from which it was
posted, including function name, file and line number.

This CL also writes a normal LOG message when the dispatch took more
than a certain amount of time (currently 50ms).

This logging should help us identify messages that are taking
longer than expected to be dispatched.

R=pthatcher@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/2019423006 .

Cr-Commit-Position: refs/heads/master@{#13104}
2016-06-10 21:17:33 +00:00
honghaiz
18f9da0286 Fix a memory issue when calling LOG_J in port.cc
The connection delete  message may be processed when a port is being deleted.
Calling LOG_J here needs to access the port object that may have been partially released.
This fixes the memcheck bot failure.

TBR=pthatcher@webrtc.org

BUG=

Review-Url: https://codereview.webrtc.org/2026403003
Cr-Commit-Position: refs/heads/master@{#13002}
2016-06-02 06:53:09 +00:00
zhihuang
5ecf16c072 Add Stats to Stun ping.
Add sent_ping_requests, recv_ping_responses to ConnectionInfo.
recv_ping_responses_ will be incremented when OnConnectionRequestResponse() is called.
ent_ping_requests_ will be incremented when OnConnectionRequestSent() is called.

BUG=webrtc:5695

Review-Url: https://codereview.webrtc.org/1940493002
Cr-Commit-Position: refs/heads/master@{#13001}
2016-06-02 00:09:24 +00:00
honghaiz
36f50e8e4e Create a new connection if a candidate reuses an address
If the remote side sends a candidate with the same address and port with an existing candidate,
but with a new ufrag and pwd, the local client will create a new connection from it
and destroy the old connection with the same remote address.

BUG=webrtc:5915

Review-Url: https://codereview.webrtc.org/2018693002
Cr-Commit-Position: refs/heads/master@{#13000}
2016-06-01 22:57:12 +00:00
honghaiz
524ecc29dd Ping connections with the fast rate until each connection is pinged at least three times,
or the connection times out or is pruned.

BUG=webrtc:5927

Review-Url: https://codereview.webrtc.org/2009763002
Cr-Commit-Position: refs/heads/master@{#12899}
2016-05-25 19:48:36 +00:00
Honghai Zhang
1590c3937c Fire a signal when the transport channel state changes
This fixes an issue that sometimes the transport channel state changes but
the transportcontroller is not notified.

BUG=5907
R=deadbeef@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1996693002 .

Cr-Commit-Position: refs/heads/master@{#12880}
2016-05-24 20:15:14 +00:00
Taylor Brandstetter
417eebe5dd Fixing the behavior of the candidate filter with pooled candidates.
According to JSEP, the candidate filter does not affect pooled
candidates because they can be filtered once they're ready to be
surfaced to the application.

So, pooled port allocator sessions will use a filter of CF_ALL, with a
new filter applied when the session is taken by a P2PTransportChannel.

When the filter is applied:
* Some candidates may no longer be returned by ReadyCandidates()
* Some candidates may no longer have a "related address" (for privacy)
* Some ports may no longer be returned by ReadyPorts()

To simplify this, the candidate filtering logic is now moved up from
the Ports to the BasicPortAllocator, with some helper methods to perform
the filtering and stripping out of data.

R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1998813002 .

Cr-Commit-Position: refs/heads/master@{#12856}
2016-05-23 23:02:29 +00:00
Honghai Zhang
351d77b702 Update the type and cost of existing networks
if the network monitor detects it after the native code does.

Also set the network cost for ethernet, wifi, unknown, cellular network type to be 0, 10, 50, 900,
so that unknown networks will have lower precedence than known networks with low cost (like Wifi) but  higher precedence than known networks with high cost.

And third, infer network type based on limited name matching in Android if there is no network monitor or network monitor did not find the type.

BUG=webrtc:5890
R=pthatcher@chromium.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1976683003 .

Cr-Commit-Position: refs/heads/master@{#12833}
2016-05-20 22:08:37 +00:00
Taylor Brandstetter
a1c303535f Relanding: Implement RTCConfiguration.iceCandidatePoolSize.
Depends on this CL in order to work in Chromium:
https://codereview.chromium.org/1976673002/

It works by creating pooled PortAllocatorSessions which can be picked up
by a P2PTransportChannel when needed (after a local description is set).

This can optimize candidate gathering time when there is some time between
creating a PeerConnection and setting a local description.

R=pthatcher@webrtc.org

Committed: 48e9d05f51

Review URL: https://codereview.webrtc.org/1956453003 .

Cr-Commit-Position: refs/heads/master@{#12729}
2016-05-13 15:15:20 +00:00
deadbeef
c55fb30649 Revert of Implement RTCConfiguration.iceCandidatePoolSize. (patchset #7 id:120001 of https://codereview.webrtc.org/1956453003/ )
Reason for revert:
Breaks remoting_unittests. They defined their own operator== which conflicts with this one.

I'll remove the operator== in a roll CL. But until it's approved, I'm reverting this so the FYI bots will pass.

Original issue's description:
> Implement RTCConfiguration.iceCandidatePoolSize.
>
> It works by creating pooled PortAllocatorSessions which can be picked up
> by a P2PTransportChannel when needed (after a local description is set).
>
> This can optimize candidate gathering time when there is some time between
> creating a PeerConnection and setting a local description.
>
> R=pthatcher@webrtc.org
>
> Committed: 48e9d05f51

TBR=pthatcher@webrtc.org,honghaiz@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.webrtc.org/1972043004
Cr-Commit-Position: refs/heads/master@{#12709}
2016-05-12 19:51:45 +00:00
Taylor Brandstetter
48e9d05f51 Implement RTCConfiguration.iceCandidatePoolSize.
It works by creating pooled PortAllocatorSessions which can be picked up
by a P2PTransportChannel when needed (after a local description is set).

This can optimize candidate gathering time when there is some time between
creating a PeerConnection and setting a local description.

R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1956453003 .

Cr-Commit-Position: refs/heads/master@{#12708}
2016-05-12 17:19:44 +00:00
Honghai Zhang
82d7862fe7 Change default timestamp to 64 bits in all webrtc directories.
BUG=
R=pbos@webrtc.org, pthatcher@webrtc.org, solenberg@webrtc.org

Review URL: https://codereview.webrtc.org/1835053002 .

Cr-Commit-Position: refs/heads/master@{#12646}
2016-05-06 18:29:27 +00:00
nisse
1bffc1d1a4 Rename rtc::Time64 --> rtc::TimeMillis.
In the discussion on https://codereview.webrtc.org/1888593004/, a more
decriptive name was suggested for Time64.

BUG=webrtc:5740

Review-Url: https://codereview.webrtc.org/1923213002
Cr-Commit-Position: refs/heads/master@{#12594}
2016-05-02 15:19:00 +00:00
kwiberg
3ec4679dd2 Replace scoped_ptr with unique_ptr in webrtc/p2p/
But keep #including scoped_ptr.h in .h files, so as not to break
WebRTC users who expect those .h files to give them rtc::scoped_ptr.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1923163003

Cr-Commit-Position: refs/heads/master@{#12532}
2016-04-27 14:22:58 +00:00
Taylor Brandstetter
0a1bc53758 Update prflx candidates' generation when setting ICE credentials.
If a STUN ping arrives before the remote description does, a prflx
candidate will be created with an unknown generation.

Once the remote description does arrive, the candidate's generation
should be set so it can be sorted properly, and replaced by a non-prflx
candidate once the candidate is signaled.

BUG=webrtc:5752
R=honghaiz@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1868353004 .

Cr-Commit-Position: refs/heads/master@{#12433}
2016-04-20 01:03:35 +00:00
jbauch
f1f87203d7 Split ByteBuffer into writer/reader objects.
This allows the reader to reference data, thus avoiding unnecessary
allocations and memory copies.

BUG=webrtc:5155,webrtc:5670

Review URL: https://codereview.webrtc.org/1821083002

Cr-Commit-Position: refs/heads/master@{#12160}
2016-03-30 13:43:44 +00:00
Honghai Zhang
cc411c0599 Reset the BWE when the network changes.
Currently "Resetting the BWE" does nothing yet. This CL passes the correct signaling to the bandwidth estimator.

BUG=
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1803063004 .

Cr-Commit-Position: refs/heads/master@{#12154}
2016-03-30 00:27:36 +00:00
honghaiz
a0c44eaa82 Add 16-bit network id to the candidate signaling.
Also include that in the stun-ping request as part of the
network-info attribute.
Change the network cost to be 16 bits.

BUG=

Review URL: https://codereview.webrtc.org/1815473002

Cr-Commit-Position: refs/heads/master@{#12110}
2016-03-23 23:07:54 +00:00
honghaiz
34b11eb66e Using 64-bit timestamp to replace the 32-bit one in webrtc/p2p.
Also changed from unsigned to signed integer per the style guide.
By the way, I kept all delta-times to be 32-bit int.

The only things left in the p2p dir are
1. proberprober/main.cc where Time() is used as the input for a random number.
2. pseudotcp.cc: where 32-bit time info is sent over the wire.

BUG=webrtc:5636

Review URL: https://codereview.webrtc.org/1793553002

Cr-Commit-Position: refs/heads/master@{#12019}
2016-03-16 15:55:48 +00:00
kwiberg
6baec0351a Port::GetStunMessage: Write to scoped_ptr instead of raw pointer
This is a good idea in general, because it makes ownership clearer,
but will also be very convenient when scoped_ptr is gone, since
unique_ptr doesn't have an .accept() method.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1800753003

Cr-Commit-Position: refs/heads/master@{#12002}
2016-03-15 18:09:59 +00:00
honghaiz
e3c6c82717 When doing continual gathering, remove the local ports when a corresponding network is dropped.
BUG=

Review URL: https://codereview.webrtc.org/1696933003

Cr-Commit-Position: refs/heads/master@{#11660}
2016-02-17 21:00:35 +00:00
honghaiz
e1a0c942d6 Add network cost as part of the connection ranking.
For now, the network cost is purely based on the network type (cellular has cost 0xFFFF and everything else has cost 0).
Add cost to the candidate signaling and the stun request signaling (which is needed for peer reflexive candidates).
BUG=webrtc:4325

Review URL: https://codereview.webrtc.org/1668073002

Cr-Commit-Position: refs/heads/master@{#11642}
2016-02-16 22:55:01 +00:00
Honghai Zhang
80f1db971d Include relay protocol type when computing the turn candidate foundation.
BUG=576353
R=deadbeef@webrtc.org, pthatcher@google.com, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1619213003 .

Cr-Commit-Position: refs/heads/master@{#11400}
2016-01-27 19:54:44 +00:00
Stefan Holmer
55674ffb32 Reland Connect TurnPort and TCPPort to AsyncPacketSocket::SignalSentPacket.
Chromium reported errors when building libjingle_nacl due to some methods used virtual instead of override when they were overriding the base class. My guess is that when one method starts using override, all other in the same class must too.

R=tommi@webrtc.org
TBR=pthatcher@webtrc.org

BUG=4173

Review URL: https://codereview.webrtc.org/1589563003 .

Cr-Commit-Position: refs/heads/master@{#11251}
2016-01-14 14:49:23 +00:00
tommi
e5e0e57bdf Revert of Connect TurnPort and TCPPort to AsyncPacketSocket::SignalSentPacket. (patchset #3 id:40001 of https://codereview.webrtc.org/1577873003/ )
Reason for revert:
Broke Chrome:

https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_compile_dbg_ng/builds/143025/steps/compile%20%28with%20patch%29/logs/stdio

FAILED: cd ../../third_party/libjingle; python ../../native_client/build/build_nexe.py --root ../.. --product-dir ../../out/Debug/xyz --config-name Debug -t ../../native_client/toolchain/ --arch pnacl --build newlib_plib --name ../../out/Debug/gen/tc_pnacl_newlib/lib/libjingle_nacl.a --objdir ../../out/Debug/obj/third_party/libjingle/libjingle_nacl.gen/pnacl_newlib-pnacl/libjingle_nacl "--include-dirs=../../out/Debug/gen/tc_pnacl_newlib/include ../.. \"../../out/Debug/gen\" ./source ../ ../../native_client_sdk/src/libraries ../../native_client_sdk/src/libraries/nacl_io/include ../../native_client_sdk/src/libraries/third_party/newlib-extras ../expat/files/lib ../boringssl/src/include" "--compile_flags=-O2 -g -Wall -fdiagnostics-show-option -Werror  -Wno-unused-function -Wno-char-subscripts -Wno-c++11-extensions -Wno-unnamed-type-template-args -Wno-extra-semi -Wno-unused-private-field -Wno-char-subscripts -Wno-unused-function \"-std=gnu++11\" " --gomadir /b/build/goma "--defines=\"__STDC_LIMIT_MACROS=1\" \"__STDC_FORMAT_MACROS=1\" \"_GNU_SOURCE=1\" \"_POSIX_C_SOURCE=199506\" \"_XOPEN_SOURCE=600\" \"DYNAMIC_ANNOTATIONS_ENABLED=1\" \"DYNAMIC_ANNOTATIONS_PREFIX=NACL_\" \"NACL_BUILD_ARCH=x86\" V8_DEPRECATION_WARNINGS \"CLD_VERSION=2\" \"_FILE_OFFSET_BITS=64\" CHROMIUM_BUILD \"CR_CLANG_REVISION=255169-1\" COMPONENT_BUILD UI_COMPOSITOR_IMAGE_TRANSPORT \"USE_AURA=1\" \"USE_ASH=1\" \"USE_PANGO=1\" \"USE_CAIRO=1\" \"USE_DEFAULT_RENDER_THEME=1\" \"USE_LIBJPEG_TURBO=1\" \"USE_X11=1\" \"IMAGE_LOADER_EXTENSION=1\" \"ENABLE_WEBRTC=1\" \"ENABLE_MEDIA_ROUTER=1\" USE_PROPRIETARY_CODECS ENABLE_PEPPER_CDMS ENABLE_CONFIGURATION_POLICY ENABLE_NOTIFICATIONS \"ENABLE_HIDPI=1\" \"ENABLE_TOPCHROME_MD=1\" USE_UDEV DONT_EMBED_BUILD_METADATA \"DCHECK_ALWAYS_ON=1\" FIELDTRIAL_TESTING_ENABLED \"ENABLE_TASK_MANAGER=1\" \"ENABLE_EXTENSIONS=1\" \"ENABLE_PDF=1\" \"ENABLE_PLUGINS=1\" \"ENABLE_SESSION_SERVICE=1\" \"ENABLE_THEMES=1\" \"ENABLE_AUTOFILL_DIALOG=1\" \"ENABLE_BACKGROUND=1\" \"ENABLE_PRINTING=1\" \"ENABLE_PRINT_PREVIEW=1\" \"ENABLE_SPELLCHECK=1\" \"ENABLE_CAPTIVE_PORTAL_DETECTION=1\" \"ENABLE_APP_LIST=1\" \"ENABLE_SUPERVISED_USERS=1\" \"ENABLE_MDNS=1\" \"ENABLE_SERVICE_DISCOVERY=1\" V8_USE_EXTERNAL_STARTUP_DATA FULL_SAFE_BROWSING SAFE_BROWSING_CSD SAFE_BROWSING_DB_LOCAL EXPAT_RELATIVE_PATH FEATURE_ENABLE_SSL GTEST_RELATIVE_PATH HAVE_OPENSSL_SSL_H NO_MAIN_THREAD_WRAPPING NO_SOUND_SYSTEM WEBRTC_POSIX SRTP_RELATIVE_PATH SSL_USE_OPENSSL USE_WEBRTC_DEV_BRANCH \"timezone=_timezone\" XML_STATIC \"USE_LIBPCI=1\" \"USE_OPENSSL=1\" \"USE_OPENSSL_CERTS=1\"" "--link_flags=-B../../out/Debug/gen/tc_pnacl_newlib/lib  " "--source-list=../../out/gypfiles/third_party/libjingle/pnacl_newlib.libjingle_nacl.source_list.gypcmd"
In file included from ../webrtc/p2p/base/tcpport.cc:67:
../webrtc/p2p/base/tcpport.h:50:23: error: 'CreateConnection' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  virtual Connection* CreateConnection(const Candidate& address,
                      ^
../webrtc/p2p/base/portinterface.h:71:23: note: overridden virtual function is here
  virtual Connection* CreateConnection(
                      ^
In file included from ../webrtc/p2p/base/tcpport.cc:67:
../webrtc/p2p/base/tcpport.h:53:16: error: 'PrepareAddress' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  virtual void PrepareAddress();
               ^
../webrtc/p2p/base/portinterface.h:63:16: note: overridden virtual function is here
  virtual void PrepareAddress() = 0;
               ^

(etc)

Original issue's description:
> Connect TurnPort and TCPPort to AsyncPacketSocket::SignalSentPacket.
>
> To reduce the risk of future mistakes when connecting Ports, Port::OnSentPacket was made pure virtual to ensure that new implementations take care of it.
>
> BUG=4173
> R=pthatcher@webrtc.org
>
> Committed: https://crrev.com/7307952a5bf63311e5f9a2a90089a06177e42716
> Cr-Commit-Position: refs/heads/master@{#11247}

TBR=pthatcher@webrtc.org,stefan@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=4173

Review URL: https://codereview.webrtc.org/1586063002

Cr-Commit-Position: refs/heads/master@{#11249}
2016-01-14 12:57:03 +00:00
Stefan Holmer
7307952a5b Connect TurnPort and TCPPort to AsyncPacketSocket::SignalSentPacket.
To reduce the risk of future mistakes when connecting Ports, Port::OnSentPacket was made pure virtual to ensure that new implementations take care of it.

BUG=4173
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1577873003 .

Cr-Commit-Position: refs/heads/master@{#11247}
2016-01-14 12:15:56 +00:00
honghaiz
37389b42b4 Don't delete an ICE connection until it has been pruned or timed out on writing in the case where it
hasn't received anything yet.  Deleting an ICE connection before it is pruned or timed out
when it hasn't received anything yet leads to ICE connections being deleted
before they have a chance to send a ping and receive a response.
BUG=

Review URL: https://codereview.webrtc.org/1544003002

Cr-Commit-Position: refs/heads/master@{#11151}
2016-01-05 05:57:42 +00:00
deadbeef
376e1235c7 Destroy a Connection if a CreatePermission request fails.
This means that if a TURN server denies permission for an
unreachable address, we'll no longer ping it fruitlessly.

BUG=webrtc:4917

Review URL: https://codereview.webrtc.org/1415313004

Cr-Commit-Position: refs/heads/master@{#10789}
2015-11-25 17:00:12 +00:00
Honghai Zhang
2cd7afe7e2 Do not delete a connection until it has not received anything for 30 seconds.
BUG=
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1422623015 .

Cr-Commit-Position: refs/heads/master@{#10626}
2015-11-12 19:14:38 +00:00
honghaiz
9b5ee9c0d9 Send back ping response if the ping comes from an unknown address.
BUG=webrtc:5171

Review URL: https://codereview.webrtc.org/1424703012

Cr-Commit-Position: refs/heads/master@{#10610}
2015-11-11 21:19:25 +00:00