OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
7 // | 7 // |
8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
10 // | 10 // |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 // Called when an error occurs while attempting to write a packet to the | 383 // Called when an error occurs while attempting to write a packet to the |
384 // network. | 384 // network. |
385 void OnWriteError(int error_code); | 385 void OnWriteError(int error_code); |
386 | 386 |
387 // If the socket is not blocked, writes queued packets. | 387 // If the socket is not blocked, writes queued packets. |
388 void WriteIfNotBlocked(); | 388 void WriteIfNotBlocked(); |
389 | 389 |
390 // Set the packet writer. | 390 // Set the packet writer. |
391 void SetQuicPacketWriter(QuicPacketWriter* writer, bool owns_writer) { | 391 void SetQuicPacketWriter(QuicPacketWriter* writer, bool owns_writer) { |
| 392 DCHECK(writer != nullptr); |
| 393 if (writer_ != nullptr && owns_writer_) { |
| 394 delete writer_; |
| 395 } |
392 writer_ = writer; | 396 writer_ = writer; |
393 owns_writer_ = owns_writer; | 397 owns_writer_ = owns_writer; |
394 } | 398 } |
395 | 399 |
396 // Set self address. | 400 // Set self address. |
397 void SetSelfAddress(IPEndPoint address) { self_address_ = address; } | 401 void SetSelfAddress(IPEndPoint address) { self_address_ = address; } |
398 | 402 |
399 // The version of the protocol this connection is using. | 403 // The version of the protocol this connection is using. |
400 QuicVersion version() const { return framer_.version(); } | 404 QuicVersion version() const { return framer_.version(); } |
401 | 405 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 bool HasQueuedData() const; | 502 bool HasQueuedData() const; |
499 | 503 |
500 // Sets the overall and idle state connection timeouts. | 504 // Sets the overall and idle state connection timeouts. |
501 void SetNetworkTimeouts(QuicTime::Delta overall_timeout, | 505 void SetNetworkTimeouts(QuicTime::Delta overall_timeout, |
502 QuicTime::Delta idle_timeout); | 506 QuicTime::Delta idle_timeout); |
503 | 507 |
504 // If the connection has timed out, this will close the connection. | 508 // If the connection has timed out, this will close the connection. |
505 // Otherwise, it will reschedule the timeout alarm. | 509 // Otherwise, it will reschedule the timeout alarm. |
506 void CheckForTimeout(); | 510 void CheckForTimeout(); |
507 | 511 |
508 // Sends a ping, and resets the ping alarm. | 512 // Called when the ping alarm fires. Causes a ping frame to be sent only |
| 513 // if the retransmission alarm is not running. |
| 514 void OnPingTimeout(); |
| 515 |
| 516 // Sends a ping frame. |
509 void SendPing(); | 517 void SendPing(); |
510 | 518 |
511 // Sets up a packet with an QuicAckFrame and sends it out. | 519 // Sets up a packet with an QuicAckFrame and sends it out. |
512 void SendAck(); | 520 void SendAck(); |
513 | 521 |
514 // Called when an RTO fires. Resets the retransmission alarm if there are | 522 // Called when an RTO fires. Resets the retransmission alarm if there are |
515 // remaining unacked packets. | 523 // remaining unacked packets. |
516 void OnRetransmissionTimeout(); | 524 void OnRetransmissionTimeout(); |
517 | 525 |
518 // Called when a data packet is sent. Starts an alarm if the data sent in | 526 // Called when a data packet is sent. Starts an alarm if the data sent in |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 989 |
982 // If true, multipath is enabled for this connection. | 990 // If true, multipath is enabled for this connection. |
983 bool multipath_enabled_; | 991 bool multipath_enabled_; |
984 | 992 |
985 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 993 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
986 }; | 994 }; |
987 | 995 |
988 } // namespace net | 996 } // namespace net |
989 | 997 |
990 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 998 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |