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

Side by Side Diff: net/quic/core/quic_connection.cc

Issue 2511893003: In case of stateless reject, change quic connection close source from client to server on client si… (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698