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

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

Issue 198263003: Avoiding a double disconnect scenario, and DFATALs on server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1611
1612 void QuicConnection::SendConnectionClose(QuicErrorCode error) { 1612 void QuicConnection::SendConnectionClose(QuicErrorCode error) {
1613 SendConnectionCloseWithDetails(error, string()); 1613 SendConnectionCloseWithDetails(error, string());
1614 } 1614 }
1615 1615
1616 void QuicConnection::SendConnectionCloseWithDetails(QuicErrorCode error, 1616 void QuicConnection::SendConnectionCloseWithDetails(QuicErrorCode error,
1617 const string& details) { 1617 const string& details) {
1618 // If we're write blocked, WritePacket() will not send, but will capture the 1618 // If we're write blocked, WritePacket() will not send, but will capture the
1619 // serialized packet. 1619 // serialized packet.
1620 SendConnectionClosePacket(error, details); 1620 SendConnectionClosePacket(error, details);
1621 CloseConnection(error, false); 1621 if (connected_) {
1622 // It's possible that while sending the connection close packet, we get a
1623 // socket error and disconnect right then and there. Avoid a double
1624 // disconnect in that case.
1625 CloseConnection(error, false);
1626 }
1622 } 1627 }
1623 1628
1624 void QuicConnection::SendConnectionClosePacket(QuicErrorCode error, 1629 void QuicConnection::SendConnectionClosePacket(QuicErrorCode error,
1625 const string& details) { 1630 const string& details) {
1626 DVLOG(1) << ENDPOINT << "Force closing " << connection_id() 1631 DVLOG(1) << ENDPOINT << "Force closing " << connection_id()
1627 << " with error " << QuicUtils::ErrorToString(error) 1632 << " with error " << QuicUtils::ErrorToString(error)
1628 << " (" << error << ") " << details; 1633 << " (" << error << ") " << details;
1629 ScopedPacketBundler ack_bundler(this, SEND_ACK); 1634 ScopedPacketBundler ack_bundler(this, SEND_ACK);
1630 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); 1635 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame();
1631 frame->error_code = error; 1636 frame->error_code = error;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 // If we changed the generator's batch state, restore original batch state. 1807 // If we changed the generator's batch state, restore original batch state.
1803 if (!already_in_batch_mode_) { 1808 if (!already_in_batch_mode_) {
1804 DVLOG(1) << "Leaving Batch Mode."; 1809 DVLOG(1) << "Leaving Batch Mode.";
1805 connection_->packet_generator_.FinishBatchOperations(); 1810 connection_->packet_generator_.FinishBatchOperations();
1806 } 1811 }
1807 DCHECK_EQ(already_in_batch_mode_, 1812 DCHECK_EQ(already_in_batch_mode_,
1808 connection_->packet_generator_.InBatchMode()); 1813 connection_->packet_generator_.InBatchMode());
1809 } 1814 }
1810 1815
1811 } // namespace net 1816 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698