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

Unified Diff: net/quic/quic_reliable_client_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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_reliable_client_stream.cc
diff --git a/net/quic/quic_reliable_client_stream.cc b/net/quic/quic_reliable_client_stream.cc
index 09fb01ef6c9fb114b07b062ffd00091f1df7fdbe..ccbf9e69e6e333f43f77f2bde42eebdffa989f93 100644
--- a/net/quic/quic_reliable_client_stream.cc
+++ b/net/quic/quic_reliable_client_stream.cc
@@ -5,19 +5,26 @@
#include "net/quic/quic_reliable_client_stream.h"
#include "net/base/net_errors.h"
+#include "net/quic/quic_session.h"
namespace net {
QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id,
QuicSession* session)
- : ReliableQuicStream(id, session) {
+ : ReliableQuicStream(id, session),
+ delegate_(NULL) {
}
QuicReliableClientStream::~QuicReliableClientStream() {
+ if (delegate_) {
+ delegate_->OnClose(error());
+ }
}
uint32 QuicReliableClientStream::ProcessData(const char* data,
uint32 data_len) {
+ // TODO(rch): buffere data if we don't have a delegate.
+ DCHECK(delegate_);
int rv = delegate_->OnDataReceived(data, data_len);
if (rv != OK) {
DLOG(ERROR) << "Delegate refused data, rv: " << rv;
@@ -28,12 +35,25 @@ uint32 QuicReliableClientStream::ProcessData(const char* data,
}
void QuicReliableClientStream::TerminateFromPeer(bool half_close) {
- delegate_->OnClose(error());
+ if (delegate_) {
+ delegate_->OnClose(error());
+ delegate_ = NULL;
+ }
}
void QuicReliableClientStream::SetDelegate(
QuicReliableClientStream::Delegate* delegate) {
+ DCHECK((!delegate_ && delegate) || (delegate_ && !delegate));
delegate_ = delegate;
}
+IPEndPoint QuicReliableClientStream::GetPeerAddress() {
+ return session()->connection()->peer_address();
+}
+
+int QuicReliableClientStream::WriteData(base::StringPiece data,
+ bool fin) {
+ return ReliableQuicStream::WriteData(data, fin);
willchan no longer on Chromium 2012/11/21 22:55:05 This looks weird. Why are we overriding to just ca
Ryan Hamilton 2012/11/21 23:06:35 I overrode it so that I could make it public. Wou
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698