Chromium Code Reviews| 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/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> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <utility> | 14 #include <utility> |
| 15 | 15 |
| 16 #include "base/debug/stack_trace.h" | |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 18 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 19 #include "net/quic/crypto/quic_decrypter.h" | 20 #include "net/quic/crypto/quic_decrypter.h" |
| 20 #include "net/quic/crypto/quic_encrypter.h" | 21 #include "net/quic/crypto/quic_encrypter.h" |
| 21 #include "net/quic/iovector.h" | 22 #include "net/quic/iovector.h" |
| 22 #include "net/quic/quic_bandwidth.h" | 23 #include "net/quic/quic_bandwidth.h" |
| 23 #include "net/quic/quic_config.h" | 24 #include "net/quic/quic_config.h" |
| 24 #include "net/quic/quic_utils.h" | 25 #include "net/quic/quic_utils.h" |
| 25 | 26 |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1627 << " (" << error << ") " << details; | 1628 << " (" << error << ") " << details; |
| 1628 ScopedPacketBundler ack_bundler(this, SEND_ACK); | 1629 ScopedPacketBundler ack_bundler(this, SEND_ACK); |
| 1629 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); | 1630 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(); |
| 1630 frame->error_code = error; | 1631 frame->error_code = error; |
| 1631 frame->error_details = details; | 1632 frame->error_details = details; |
| 1632 packet_generator_.AddControlFrame(QuicFrame(frame)); | 1633 packet_generator_.AddControlFrame(QuicFrame(frame)); |
| 1633 Flush(); | 1634 Flush(); |
| 1634 } | 1635 } |
| 1635 | 1636 |
| 1636 void QuicConnection::CloseConnection(QuicErrorCode error, bool from_peer) { | 1637 void QuicConnection::CloseConnection(QuicErrorCode error, bool from_peer) { |
| 1637 DCHECK(connected_); | |
| 1638 if (!connected_) { | 1638 if (!connected_) { |
| 1639 LOG(DFATAL) << "Error: attempt to close an already closed connection" | |
|
Ryan Hamilton
2014/02/27 00:30:53
nit: I'd switch this to DLOG
ramant (doing other things)
2014/02/27 01:05:13
Fixed in Patch set of https://codereview.chromium.
| |
| 1640 << base::debug::StackTrace().ToString(); | |
| 1639 return; | 1641 return; |
| 1640 } | 1642 } |
| 1641 connected_ = false; | 1643 connected_ = false; |
| 1642 visitor_->OnConnectionClosed(error, from_peer); | 1644 visitor_->OnConnectionClosed(error, from_peer); |
| 1643 // Cancel the alarms so they don't trigger any action now that the | 1645 // Cancel the alarms so they don't trigger any action now that the |
| 1644 // connection is closed. | 1646 // connection is closed. |
| 1645 ack_alarm_->Cancel(); | 1647 ack_alarm_->Cancel(); |
| 1646 resume_writes_alarm_->Cancel(); | 1648 resume_writes_alarm_->Cancel(); |
| 1647 retransmission_alarm_->Cancel(); | 1649 retransmission_alarm_->Cancel(); |
| 1648 send_alarm_->Cancel(); | 1650 send_alarm_->Cancel(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1800 // If we changed the generator's batch state, restore original batch state. | 1802 // If we changed the generator's batch state, restore original batch state. |
| 1801 if (!already_in_batch_mode_) { | 1803 if (!already_in_batch_mode_) { |
| 1802 DVLOG(1) << "Leaving Batch Mode."; | 1804 DVLOG(1) << "Leaving Batch Mode."; |
| 1803 connection_->packet_generator_.FinishBatchOperations(); | 1805 connection_->packet_generator_.FinishBatchOperations(); |
| 1804 } | 1806 } |
| 1805 DCHECK_EQ(already_in_batch_mode_, | 1807 DCHECK_EQ(already_in_batch_mode_, |
| 1806 connection_->packet_generator_.InBatchMode()); | 1808 connection_->packet_generator_.InBatchMode()); |
| 1807 } | 1809 } |
| 1808 | 1810 |
| 1809 } // namespace net | 1811 } // namespace net |
| OLD | NEW |