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

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

Issue 1279433006: Add a rate tracker that tracks rate over a given interval split up into buckets that accumulate uni… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: New tests and readability fixes. Created 5 years, 3 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
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/video/receive_statistics_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // TODO: Should STATE_WRITE_TIMEOUT return a non-blocking error? 337 // TODO: Should STATE_WRITE_TIMEOUT return a non-blocking error?
338 error_ = EWOULDBLOCK; 338 error_ = EWOULDBLOCK;
339 return SOCKET_ERROR; 339 return SOCKET_ERROR;
340 } 340 }
341 sent_packets_total_++; 341 sent_packets_total_++;
342 int sent = socket_->Send(data, size, options); 342 int sent = socket_->Send(data, size, options);
343 if (sent < 0) { 343 if (sent < 0) {
344 sent_packets_discarded_++; 344 sent_packets_discarded_++;
345 error_ = socket_->GetError(); 345 error_ = socket_->GetError();
346 } else { 346 } else {
347 send_rate_tracker_.Update(sent); 347 send_rate_tracker_.AddSamples(sent);
348 } 348 }
349 return sent; 349 return sent;
350 } 350 }
351 351
352 int TCPConnection::GetError() { 352 int TCPConnection::GetError() {
353 return error_; 353 return error_;
354 } 354 }
355 355
356 void TCPConnection::OnConnectionRequestResponse(ConnectionRequest* req, 356 void TCPConnection::OnConnectionRequestResponse(ConnectionRequest* req,
357 StunMessage* response) { 357 StunMessage* response) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { 468 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) {
469 if (outgoing_) { 469 if (outgoing_) {
470 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); 470 socket->SignalConnect.connect(this, &TCPConnection::OnConnect);
471 } 471 }
472 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); 472 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket);
473 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); 473 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend);
474 socket->SignalClose.connect(this, &TCPConnection::OnClose); 474 socket->SignalClose.connect(this, &TCPConnection::OnClose);
475 } 475 }
476 476
477 } // namespace cricket 477 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/video/receive_statistics_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698