OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |