Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: net/quic/reliable_quic_stream.cc

Issue 11364068: Add a QuicHttpStream class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bugs Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« net/quic/quic_reliable_client_stream.cc ('K') | « net/quic/quic_reliable_client_stream_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698