| 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 #include "net/quic/core/quic_connection.h" | 5 #include "net/quic/core/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 | 2047 |
| 2048 if (connection_close_behavior == | 2048 if (connection_close_behavior == |
| 2049 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET) { | 2049 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET) { |
| 2050 SendConnectionClosePacket(error, error_details, SEND_ACK); | 2050 SendConnectionClosePacket(error, error_details, SEND_ACK); |
| 2051 } else if (connection_close_behavior == | 2051 } else if (connection_close_behavior == |
| 2052 ConnectionCloseBehavior:: | 2052 ConnectionCloseBehavior:: |
| 2053 SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK) { | 2053 SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK) { |
| 2054 SendConnectionClosePacket(error, error_details, NO_ACK); | 2054 SendConnectionClosePacket(error, error_details, NO_ACK); |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 TearDownLocalConnectionState(error, error_details, | 2057 ConnectionCloseSource source = ConnectionCloseSource::FROM_SELF; |
| 2058 ConnectionCloseSource::FROM_SELF); | 2058 if (perspective_ == Perspective::IS_CLIENT && |
| 2059 error == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { |
| 2060 // Regard stateless rejected connection as closed by server. |
| 2061 source = ConnectionCloseSource::FROM_PEER; |
| 2062 } |
| 2063 TearDownLocalConnectionState(error, error_details, source); |
| 2059 } | 2064 } |
| 2060 | 2065 |
| 2061 void QuicConnection::SendConnectionClosePacket(QuicErrorCode error, | 2066 void QuicConnection::SendConnectionClosePacket(QuicErrorCode error, |
| 2062 const string& details, | 2067 const string& details, |
| 2063 AckBundling ack_mode) { | 2068 AckBundling ack_mode) { |
| 2064 DVLOG(1) << ENDPOINT << "Sending connection close packet."; | 2069 DVLOG(1) << ENDPOINT << "Sending connection close packet."; |
| 2065 ClearQueuedPackets(); | 2070 ClearQueuedPackets(); |
| 2066 ScopedPacketBundler ack_bundler(this, ack_mode); | 2071 ScopedPacketBundler ack_bundler(this, ack_mode); |
| 2067 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); | 2072 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); |
| 2068 frame->error_code = error; | 2073 frame->error_code = error; |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 | 2560 |
| 2556 void QuicConnection::CheckIfApplicationLimited() { | 2561 void QuicConnection::CheckIfApplicationLimited() { |
| 2557 if (queued_packets_.empty() && | 2562 if (queued_packets_.empty() && |
| 2558 !sent_packet_manager_->HasPendingRetransmissions() && | 2563 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2559 !visitor_->WillingAndAbleToWrite()) { | 2564 !visitor_->WillingAndAbleToWrite()) { |
| 2560 sent_packet_manager_->OnApplicationLimited(); | 2565 sent_packet_manager_->OnApplicationLimited(); |
| 2561 } | 2566 } |
| 2562 } | 2567 } |
| 2563 | 2568 |
| 2564 } // namespace net | 2569 } // namespace net |
| OLD | NEW |