Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index 2ed5b073e181a63d75ad875d686cf1bbdffeff0d..3df8b0ad386af5702b3f7c4da172d30811fef28e 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -14,6 +14,8 @@ using std::vector; |
namespace net { |
+#define ENDPOINT (is_server_ ? "Server: " : " Client: ") |
+ |
// We want to make sure we delete any closed streams in a safe manner. |
// To avoid deleting a stream in mid-operation, we have a simple shim between |
// us and the stream, so we can delete any streams when we return from |
@@ -74,6 +76,7 @@ QuicSession::QuicSession(QuicConnection* connection, |
next_stream_id_(is_server ? 2 : 3), |
is_server_(is_server), |
largest_peer_created_stream_id_(0), |
+ error_(QUIC_NO_ERROR), |
goaway_received_(false), |
goaway_sent_(false) { |
set_max_open_streams(config_.max_streams_per_connection()); |
@@ -95,7 +98,7 @@ bool QuicSession::OnPacket(const IPEndPoint& self_address, |
const QuicPacketHeader& header, |
const vector<QuicStreamFrame>& frames) { |
if (header.public_header.guid != connection()->guid()) { |
- DLOG(INFO) << "Got packet header for invalid GUID: " |
+ DLOG(INFO) << ENDPOINT << "Got packet header for invalid GUID: " |
<< header.public_header.guid; |
return false; |
} |
@@ -149,13 +152,17 @@ void QuicSession::OnGoAway(const QuicGoAwayFrame& frame) { |
} |
void QuicSession::ConnectionClose(QuicErrorCode error, bool from_peer) { |
+ if (error_ == QUIC_NO_ERROR) { |
+ error_ = error; |
+ } |
+ |
while (stream_map_.size() != 0) { |
ReliableStreamMap::iterator it = stream_map_.begin(); |
QuicStreamId id = it->first; |
it->second->ConnectionClose(error, from_peer); |
// The stream should call CloseStream as part of ConnectionClose. |
if (stream_map_.find(id) != stream_map_.end()) { |
- LOG(DFATAL) << "Stream failed to close under ConnectionClose"; |
+ LOG(DFATAL) << ENDPOINT << "Stream failed to close under ConnectionClose"; |
CloseStream(id); |
} |
} |
@@ -201,11 +208,11 @@ void QuicSession::SendGoAway(QuicErrorCode error_code, const string& reason) { |
} |
void QuicSession::CloseStream(QuicStreamId stream_id) { |
- DLOG(INFO) << "Closing stream " << stream_id; |
+ DLOG(INFO) << ENDPOINT << "Closing stream " << stream_id; |
ReliableStreamMap::iterator it = stream_map_.find(stream_id); |
if (it == stream_map_.end()) { |
- DLOG(INFO) << "Stream is already closed: " << stream_id; |
+ DLOG(INFO) << ENDPOINT << "Stream is already closed: " << stream_id; |
return; |
} |
ReliableQuicStream* stream = it->second; |
@@ -237,7 +244,7 @@ void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
break; |
case HANDSHAKE_CONFIRMED: |
- LOG_IF(DFATAL, !config_.negotiated()) |
+ LOG_IF(DFATAL, !config_.negotiated()) << ENDPOINT |
<< "Handshake confirmed without parameter negotiation."; |
connection_->SetIdleNetworkTimeout( |
config_.idle_connection_state_lifetime()); |
@@ -246,7 +253,7 @@ void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
break; |
default: |
- LOG(ERROR) << "Got unknown handshake event: " << event; |
+ LOG(ERROR) << ENDPOINT << "Got unknown handshake event: " << event; |
} |
} |
@@ -255,8 +262,8 @@ QuicConfig* QuicSession::config() { |
} |
void QuicSession::ActivateStream(ReliableQuicStream* stream) { |
- DLOG(INFO) << "num_streams: " << stream_map_.size() |
- << ". activating " << stream->id(); |
+ DLOG(INFO) << ENDPOINT << "num_streams: " << stream_map_.size() |
+ << ". activating " << stream->id(); |
DCHECK(stream_map_.count(stream->id()) == 0); |
stream_map_[stream->id()] = stream; |
} |