| 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/ssl/ssl_info.h" | 10 #include "net/ssl/ssl_info.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 session_->OnAck(acked_packets); | 56 session_->OnAck(acked_packets); |
| 57 session_->PostProcessAfterData(); | 57 session_->PostProcessAfterData(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual bool OnCanWrite() OVERRIDE { | 60 virtual bool OnCanWrite() OVERRIDE { |
| 61 bool rc = session_->OnCanWrite(); | 61 bool rc = session_->OnCanWrite(); |
| 62 session_->PostProcessAfterData(); | 62 session_->PostProcessAfterData(); |
| 63 return rc; | 63 return rc; |
| 64 } | 64 } |
| 65 | 65 |
| 66 virtual void OnSuccessfulVersionNegotiation( |
| 67 const QuicVersion& version) OVERRIDE { |
| 68 session_->OnSuccessfulVersionNegotiation(version); |
| 69 } |
| 70 |
| 66 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE { | 71 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE { |
| 67 session_->ConnectionClose(error, from_peer); | 72 session_->ConnectionClose(error, from_peer); |
| 68 // The session will go away, so don't bother with cleanup. | 73 // The session will go away, so don't bother with cleanup. |
| 69 } | 74 } |
| 70 | 75 |
| 71 private: | 76 private: |
| 72 QuicSession* session_; | 77 QuicSession* session_; |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 QuicSession::QuicSession(QuicConnection* connection, | 80 QuicSession::QuicSession(QuicConnection* connection, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // If the stream can't write all bytes, it'll re-add itself to the blocked | 231 // If the stream can't write all bytes, it'll re-add itself to the blocked |
| 227 // list. | 232 // list. |
| 228 stream->OnCanWrite(); | 233 stream->OnCanWrite(); |
| 229 } | 234 } |
| 230 --remaining_writes; | 235 --remaining_writes; |
| 231 } | 236 } |
| 232 | 237 |
| 233 return !write_blocked_streams_.HasWriteBlockedStreams(); | 238 return !write_blocked_streams_.HasWriteBlockedStreams(); |
| 234 } | 239 } |
| 235 | 240 |
| 236 QuicConsumedData QuicSession::WriteData(QuicStreamId id, | 241 QuicConsumedData QuicSession::WritevData(QuicStreamId id, |
| 237 StringPiece data, | 242 const struct iovec* iov, |
| 238 QuicStreamOffset offset, | 243 int count, |
| 239 bool fin) { | 244 QuicStreamOffset offset, |
| 240 return connection_->SendStreamData(id, data, offset, fin); | 245 bool fin) { |
| 246 return connection_->SendvStreamData(id, iov, count, offset, fin); |
| 241 } | 247 } |
| 242 | 248 |
| 243 void QuicSession::SendRstStream(QuicStreamId id, | 249 void QuicSession::SendRstStream(QuicStreamId id, |
| 244 QuicRstStreamErrorCode error) { | 250 QuicRstStreamErrorCode error) { |
| 245 connection_->SendRstStream(id, error); | 251 connection_->SendRstStream(id, error); |
| 246 CloseStreamInner(id, true); | 252 CloseStreamInner(id, true); |
| 247 } | 253 } |
| 248 | 254 |
| 249 void QuicSession::SendGoAway(QuicErrorCode error_code, const string& reason) { | 255 void QuicSession::SendGoAway(QuicErrorCode error_code, const string& reason) { |
| 250 goaway_sent_ = true; | 256 goaway_sent_ = true; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // streams. | 473 // streams. |
| 468 return id <= largest_peer_created_stream_id_ && | 474 return id <= largest_peer_created_stream_id_ && |
| 469 implicitly_created_streams_.count(id) == 0; | 475 implicitly_created_streams_.count(id) == 0; |
| 470 } | 476 } |
| 471 | 477 |
| 472 size_t QuicSession::GetNumOpenStreams() const { | 478 size_t QuicSession::GetNumOpenStreams() const { |
| 473 return stream_map_.size() + implicitly_created_streams_.size() - | 479 return stream_map_.size() + implicitly_created_streams_.size() - |
| 474 zombie_streams_.size(); | 480 zombie_streams_.size(); |
| 475 } | 481 } |
| 476 | 482 |
| 477 void QuicSession::MarkWriteBlocked(QuicStreamId id) { | 483 void QuicSession::MarkWriteBlocked(QuicStreamId id, QuicPriority priority) { |
| 478 write_blocked_streams_.PushBack(id, 0); | 484 write_blocked_streams_.PushBack(id, priority); |
| 479 } | 485 } |
| 480 | 486 |
| 481 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, | 487 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, |
| 482 QuicStreamId stream_id) { | 488 QuicStreamId stream_id) { |
| 483 decompression_blocked_streams_[header_id] = stream_id; | 489 decompression_blocked_streams_[header_id] = stream_id; |
| 484 } | 490 } |
| 485 | 491 |
| 486 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) { | 492 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) { |
| 487 NOTIMPLEMENTED(); | 493 NOTIMPLEMENTED(); |
| 488 return false; | 494 return false; |
| 489 } | 495 } |
| 490 | 496 |
| 491 void QuicSession::PostProcessAfterData() { | 497 void QuicSession::PostProcessAfterData() { |
| 492 STLDeleteElements(&closed_streams_); | 498 STLDeleteElements(&closed_streams_); |
| 493 closed_streams_.clear(); | 499 closed_streams_.clear(); |
| 494 } | 500 } |
| 495 | 501 |
| 496 } // namespace net | 502 } // namespace net |
| OLD | NEW |