| 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_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 bool QuicSession::HasOpenDataStreams() const { | 359 bool QuicSession::HasOpenDataStreams() const { |
| 360 return GetNumOpenStreams() > 0; | 360 return GetNumOpenStreams() > 0; |
| 361 } | 361 } |
| 362 | 362 |
| 363 QuicConsumedData QuicSession::WritevData( | 363 QuicConsumedData QuicSession::WritevData( |
| 364 QuicStreamId id, | 364 QuicStreamId id, |
| 365 const IOVector& data, | 365 const IOVector& data, |
| 366 QuicStreamOffset offset, | 366 QuicStreamOffset offset, |
| 367 bool fin, | 367 bool fin, |
| 368 FecProtection fec_protection, |
| 368 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { | 369 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { |
| 369 return connection_->SendStreamData(id, data, offset, fin, | 370 return connection_->SendStreamData(id, data, offset, fin, fec_protection, |
| 370 ack_notifier_delegate); | 371 ack_notifier_delegate); |
| 371 } | 372 } |
| 372 | 373 |
| 373 size_t QuicSession::WriteHeaders( | 374 size_t QuicSession::WriteHeaders( |
| 374 QuicStreamId id, | 375 QuicStreamId id, |
| 375 const SpdyHeaderBlock& headers, | 376 const SpdyHeaderBlock& headers, |
| 376 bool fin, | 377 bool fin, |
| 377 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { | 378 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { |
| 378 return headers_stream_->WriteHeaders(id, headers, fin, ack_notifier_delegate); | 379 return headers_stream_->WriteHeaders(id, headers, fin, ack_notifier_delegate); |
| 379 } | 380 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 return; | 445 return; |
| 445 } | 446 } |
| 446 | 447 |
| 447 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 448 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
| 448 << " for stream " << stream_id; | 449 << " for stream " << stream_id; |
| 449 uint64 offset_diff = final_byte_offset - it->second; | 450 uint64 offset_diff = final_byte_offset - it->second; |
| 450 if (flow_controller_->UpdateHighestReceivedOffset( | 451 if (flow_controller_->UpdateHighestReceivedOffset( |
| 451 flow_controller_->highest_received_byte_offset() + offset_diff)) { | 452 flow_controller_->highest_received_byte_offset() + offset_diff)) { |
| 452 // If the final offset violates flow control, close the connection now. | 453 // If the final offset violates flow control, close the connection now. |
| 453 if (flow_controller_->FlowControlViolation()) { | 454 if (flow_controller_->FlowControlViolation()) { |
| 454 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA); | 455 connection_->SendConnectionClose( |
| 456 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA); |
| 455 return; | 457 return; |
| 456 } | 458 } |
| 457 } | 459 } |
| 458 | 460 |
| 459 flow_controller_->AddBytesConsumed(offset_diff); | 461 flow_controller_->AddBytesConsumed(offset_diff); |
| 460 locally_closed_streams_highest_offset_.erase(it); | 462 locally_closed_streams_highest_offset_.erase(it); |
| 461 } | 463 } |
| 462 | 464 |
| 463 bool QuicSession::IsEncryptionEstablished() { | 465 bool QuicSession::IsEncryptionEstablished() { |
| 464 return GetCryptoStream()->encryption_established(); | 466 return GetCryptoStream()->encryption_established(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 // with a different version. | 710 // with a different version. |
| 709 for (DataStreamMap::iterator it = stream_map_.begin(); | 711 for (DataStreamMap::iterator it = stream_map_.begin(); |
| 710 it != stream_map_.end(); ++it) { | 712 it != stream_map_.end(); ++it) { |
| 711 if (version < QUIC_VERSION_17) { | 713 if (version < QUIC_VERSION_17) { |
| 712 it->second->flow_controller()->Disable(); | 714 it->second->flow_controller()->Disable(); |
| 713 } | 715 } |
| 714 } | 716 } |
| 715 } | 717 } |
| 716 | 718 |
| 717 } // namespace net | 719 } // namespace net |
| OLD | NEW |