Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: webrtc/p2p/base/port.cc

Issue 2009763002: Ping connections with the fast rate until each connection is pinged at least three times. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 } 1159 }
1160 1160
1161 void Connection::Ping(int64_t now) { 1161 void Connection::Ping(int64_t now) {
1162 last_ping_sent_ = now; 1162 last_ping_sent_ = now;
1163 ConnectionRequest *req = new ConnectionRequest(this); 1163 ConnectionRequest *req = new ConnectionRequest(this);
1164 pings_since_last_response_.push_back(SentPing(req->id(), now)); 1164 pings_since_last_response_.push_back(SentPing(req->id(), now));
1165 LOG_J(LS_VERBOSE, this) << "Sending STUN ping " 1165 LOG_J(LS_VERBOSE, this) << "Sending STUN ping "
1166 << ", id=" << rtc::hex_encode(req->id()); 1166 << ", id=" << rtc::hex_encode(req->id());
1167 requests_.Send(req); 1167 requests_.Send(req);
1168 state_ = STATE_INPROGRESS; 1168 state_ = STATE_INPROGRESS;
1169 num_pings_sent_++;
1169 } 1170 }
1170 1171
1171 void Connection::ReceivedPing() { 1172 void Connection::ReceivedPing() {
1172 set_receiving(true); 1173 set_receiving(true);
1173 last_ping_received_ = rtc::TimeMillis(); 1174 last_ping_received_ = rtc::TimeMillis();
1174 } 1175 }
1175 1176
1176 void Connection::ReceivedPingResponse() { 1177 void Connection::ReceivedPingResponse() {
1177 // We've already validated that this is a STUN binding response with 1178 // We've already validated that this is a STUN binding response with
1178 // the correct local and remote username for this connection. 1179 // the correct local and remote username for this connection.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 remote_candidate_.address() == new_candidate.address() && 1378 remote_candidate_.address() == new_candidate.address() &&
1378 remote_candidate_.username() == new_candidate.username() && 1379 remote_candidate_.username() == new_candidate.username() &&
1379 remote_candidate_.password() == new_candidate.password() && 1380 remote_candidate_.password() == new_candidate.password() &&
1380 remote_candidate_.generation() == new_candidate.generation()) { 1381 remote_candidate_.generation() == new_candidate.generation()) {
1381 remote_candidate_ = new_candidate; 1382 remote_candidate_ = new_candidate;
1382 } 1383 }
1383 } 1384 }
1384 1385
1385 void Connection::OnMessage(rtc::Message *pmsg) { 1386 void Connection::OnMessage(rtc::Message *pmsg) {
1386 ASSERT(pmsg->message_id == MSG_DELETE); 1387 ASSERT(pmsg->message_id == MSG_DELETE);
1387 LOG_J(LS_INFO, this) << "Connection deleted"; 1388 LOG_J(LS_INFO, this) << "Connection deleted with number of pings sent: "
1389 << num_pings_sent_;
1388 SignalDestroyed(this); 1390 SignalDestroyed(this);
1389 delete this; 1391 delete this;
1390 } 1392 }
1391 1393
1392 int64_t Connection::last_received() const { 1394 int64_t Connection::last_received() const {
1393 return std::max(last_data_received_, 1395 return std::max(last_data_received_,
1394 std::max(last_ping_received_, last_ping_response_received_)); 1396 std::max(last_ping_received_, last_ping_response_received_));
1395 } 1397 }
1396 1398
1397 size_t Connection::recv_bytes_second() { 1399 size_t Connection::recv_bytes_second() {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 ASSERT(sent < 0); 1505 ASSERT(sent < 0);
1504 error_ = port_->GetError(); 1506 error_ = port_->GetError();
1505 sent_packets_discarded_++; 1507 sent_packets_discarded_++;
1506 } else { 1508 } else {
1507 send_rate_tracker_.AddSamples(sent); 1509 send_rate_tracker_.AddSamples(sent);
1508 } 1510 }
1509 return sent; 1511 return sent;
1510 } 1512 }
1511 1513
1512 } // namespace cricket 1514 } // namespace cricket
OLDNEW
« webrtc/p2p/base/p2ptransportchannel_unittest.cc ('K') | « webrtc/p2p/base/port.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698