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

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

Issue 1940493002: Add Stats to Stun ping. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Store ConnectionInfo to Connection to reduce duplication. 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return SOCKET_ERROR; 344 return SOCKET_ERROR;
345 } 345 }
346 346
347 // Note that this is important to put this after the previous check to give 347 // Note that this is important to put this after the previous check to give
348 // the connection a chance to reconnect. 348 // the connection a chance to reconnect.
349 if (pretending_to_be_writable_ || write_state() != STATE_WRITABLE) { 349 if (pretending_to_be_writable_ || write_state() != STATE_WRITABLE) {
350 // TODO: Should STATE_WRITE_TIMEOUT return a non-blocking error? 350 // TODO: Should STATE_WRITE_TIMEOUT return a non-blocking error?
351 error_ = EWOULDBLOCK; 351 error_ = EWOULDBLOCK;
352 return SOCKET_ERROR; 352 return SOCKET_ERROR;
353 } 353 }
354 sent_packets_total_++; 354 // sent_packets_total_++;
pthatcher1 2016/06/01 21:39:49 This comment isn't needed.
zhihuang1 2016/06/01 22:34:04 Done.
355 connection_info_.sent_total_packets++;
355 int sent = socket_->Send(data, size, options); 356 int sent = socket_->Send(data, size, options);
356 if (sent < 0) { 357 if (sent < 0) {
357 sent_packets_discarded_++; 358 // sent_packets_discarded_++;
pthatcher1 2016/06/01 21:39:49 Nor this one.
zhihuang1 2016/06/01 22:34:04 Done.
359 connection_info_.sent_discarded_packets++;
358 error_ = socket_->GetError(); 360 error_ = socket_->GetError();
359 } else { 361 } else {
360 send_rate_tracker_.AddSamples(sent); 362 send_rate_tracker_.AddSamples(sent);
361 } 363 }
362 return sent; 364 return sent;
363 } 365 }
364 366
365 int TCPConnection::GetError() { 367 int TCPConnection::GetError() {
366 return error_; 368 return error_;
367 } 369 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { 514 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) {
513 if (outgoing_) { 515 if (outgoing_) {
514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); 516 socket->SignalConnect.connect(this, &TCPConnection::OnConnect);
515 } 517 }
516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); 518 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket);
517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); 519 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend);
518 socket->SignalClose.connect(this, &TCPConnection::OnClose); 520 socket->SignalClose.connect(this, &TCPConnection::OnClose);
519 } 521 }
520 522
521 } // namespace cricket 523 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698