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/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
6 | 6 |
7 #include "net/quic/quic_session.h" | 7 #include "net/quic/quic_session.h" |
8 | 8 |
9 using base::StringPiece; | 9 using base::StringPiece; |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool ReliableQuicStream::HasBytesToRead() const { | 89 bool ReliableQuicStream::HasBytesToRead() const { |
90 return sequencer_.HasBytesToRead(); | 90 return sequencer_.HasBytesToRead(); |
91 } | 91 } |
92 | 92 |
93 int ReliableQuicStream::WriteData(StringPiece data, bool fin) { | 93 int ReliableQuicStream::WriteData(StringPiece data, bool fin) { |
94 if (write_side_closed_) { | 94 if (write_side_closed_) { |
95 DLOG(ERROR) << "Attempt to write when the write side is closed"; | 95 DLOG(ERROR) << "Attempt to write when the write side is closed"; |
96 return 0; | 96 return 0; |
97 } | 97 } |
98 | 98 |
99 session()->WriteData(id(), data, offset_, fin); | 99 int rv = session()->WriteData(id(), data, offset_, fin); |
100 offset_ += data.length(); | 100 offset_ += data.length(); |
101 if (fin) { | 101 if (fin) { |
102 CloseWriteSide(); | 102 CloseWriteSide(); |
103 } | 103 } |
104 return data.length(); | 104 return rv; |
105 } | 105 } |
106 | 106 |
107 void ReliableQuicStream::CloseReadSide() { | 107 void ReliableQuicStream::CloseReadSide() { |
108 if (read_side_closed_) { | 108 if (read_side_closed_) { |
109 return; | 109 return; |
110 } | 110 } |
111 DLOG(INFO) << "Done reading from stream " << id(); | 111 DLOG(INFO) << "Done reading from stream " << id(); |
112 | 112 |
113 read_side_closed_ = true; | 113 read_side_closed_ = true; |
114 if (write_side_closed_) { | 114 if (write_side_closed_) { |
| 115 LOG(INFO) << "Closing stream: " << id(); |
115 session_->CloseStream(id()); | 116 session_->CloseStream(id()); |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
119 void ReliableQuicStream::CloseWriteSide() { | 120 void ReliableQuicStream::CloseWriteSide() { |
120 if (write_side_closed_) { | 121 if (write_side_closed_) { |
121 return; | 122 return; |
122 } | 123 } |
123 DLOG(INFO) << "Done writing to stream " << id(); | 124 DLOG(INFO) << "Done writing to stream " << id(); |
124 | 125 |
125 write_side_closed_ = true; | 126 write_side_closed_ = true; |
126 if (read_side_closed_) { | 127 if (read_side_closed_) { |
| 128 LOG(INFO) << "Closing stream: " << id(); |
127 session_->CloseStream(id()); | 129 session_->CloseStream(id()); |
128 } | 130 } |
129 } | 131 } |
130 | 132 |
131 } // namespace net | 133 } // namespace net |
OLD | NEW |