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_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/crypto/proof_verifier.h" | 8 #include "net/quic/crypto/proof_verifier.h" |
9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_flow_controller.h" | 10 #include "net/quic/quic_flow_controller.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 void QuicSession::SendRstStream(QuicStreamId id, | 375 void QuicSession::SendRstStream(QuicStreamId id, |
376 QuicRstStreamErrorCode error, | 376 QuicRstStreamErrorCode error, |
377 QuicStreamOffset bytes_written) { | 377 QuicStreamOffset bytes_written) { |
378 if (connection()->connected()) { | 378 if (connection()->connected()) { |
379 // Only send a RST_STREAM frame if still connected. | 379 // Only send a RST_STREAM frame if still connected. |
380 connection_->SendRstStream(id, error, bytes_written); | 380 connection_->SendRstStream(id, error, bytes_written); |
381 } | 381 } |
382 CloseStreamInner(id, true); | 382 CloseStreamInner(id, true); |
383 } | 383 } |
384 | 384 |
385 void QuicSession::SendGoAway(QuicErrorCode error_code, const string& reason) { | 385 void QuicSession::SendGoAway(QuicErrorCode error_code, |
| 386 const std::string& reason) { |
386 if (goaway_sent_) { | 387 if (goaway_sent_) { |
387 return; | 388 return; |
388 } | 389 } |
389 goaway_sent_ = true; | 390 goaway_sent_ = true; |
390 connection_->SendGoAway(error_code, largest_peer_created_stream_id_, reason); | 391 connection_->SendGoAway(error_code, largest_peer_created_stream_id_, reason); |
391 } | 392 } |
392 | 393 |
393 void QuicSession::CloseStream(QuicStreamId stream_id) { | 394 void QuicSession::CloseStream(QuicStreamId stream_id) { |
394 CloseStreamInner(stream_id, false); | 395 CloseStreamInner(stream_id, false); |
395 } | 396 } |
(...skipping 26 matching lines...) Expand all Loading... |
422 } | 423 } |
423 | 424 |
424 stream_map_.erase(it); | 425 stream_map_.erase(it); |
425 stream->OnClose(); | 426 stream->OnClose(); |
426 // Decrease the number of streams being emulated when a new one is opened. | 427 // Decrease the number of streams being emulated when a new one is opened. |
427 connection_->SetNumOpenStreams(stream_map_.size()); | 428 connection_->SetNumOpenStreams(stream_map_.size()); |
428 } | 429 } |
429 | 430 |
430 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 431 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
431 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 432 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
432 map<QuicStreamId, QuicStreamOffset>::iterator it = | 433 std::map<QuicStreamId, QuicStreamOffset>::iterator it = |
433 locally_closed_streams_highest_offset_.find(stream_id); | 434 locally_closed_streams_highest_offset_.find(stream_id); |
434 if (it == locally_closed_streams_highest_offset_.end()) { | 435 if (it == locally_closed_streams_highest_offset_.end()) { |
435 return; | 436 return; |
436 } | 437 } |
437 | 438 |
438 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 439 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
439 << " for stream " << stream_id; | 440 << " for stream " << stream_id; |
440 uint64 offset_diff = final_byte_offset - it->second; | 441 uint64 offset_diff = final_byte_offset - it->second; |
441 if (flow_controller_->UpdateHighestReceivedOffset( | 442 if (flow_controller_->UpdateHighestReceivedOffset( |
442 flow_controller_->highest_received_byte_offset() + offset_diff)) { | 443 flow_controller_->highest_received_byte_offset() + offset_diff)) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 for (DataStreamMap::iterator it = stream_map_.begin(); | 776 for (DataStreamMap::iterator it = stream_map_.begin(); |
776 it != stream_map_.end(); ++it) { | 777 it != stream_map_.end(); ++it) { |
777 if (it->second->flow_controller()->IsBlocked()) { | 778 if (it->second->flow_controller()->IsBlocked()) { |
778 return true; | 779 return true; |
779 } | 780 } |
780 } | 781 } |
781 return false; | 782 return false; |
782 } | 783 } |
783 | 784 |
784 } // namespace net | 785 } // namespace net |
OLD | NEW |