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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 stats_.sent_total_packets++; |
355 int sent = socket_->Send(data, size, options); | 355 int sent = socket_->Send(data, size, options); |
356 if (sent < 0) { | 356 if (sent < 0) { |
357 sent_packets_discarded_++; | 357 stats_.sent_discarded_packets++; |
358 error_ = socket_->GetError(); | 358 error_ = socket_->GetError(); |
359 } else { | 359 } else { |
360 send_rate_tracker_.AddSamples(sent); | 360 send_rate_tracker_.AddSamples(sent); |
361 } | 361 } |
362 return sent; | 362 return sent; |
363 } | 363 } |
364 | 364 |
365 int TCPConnection::GetError() { | 365 int TCPConnection::GetError() { |
366 return error_; | 366 return error_; |
367 } | 367 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
513 if (outgoing_) { | 513 if (outgoing_) { |
514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
515 } | 515 } |
516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
518 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 518 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
519 } | 519 } |
520 | 520 |
521 } // namespace cricket | 521 } // namespace cricket |
OLD | NEW |