summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorerikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 23:04:29 +0000
committererikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 23:04:29 +0000
commita5c493b9b38dcb17d5e621e06a9c9bb9e317c2f9 (patch)
tree33a045be67757b8924c0bbf15b3bf6d5a3d72991 /net/spdy
parentedf3d849086614af42fb5b84d59cefdea5adf4ac (diff)
downloadchromium_src-a5c493b9b38dcb17d5e621e06a9c9bb9e317c2f9.zip
chromium_src-a5c493b9b38dcb17d5e621e06a9c9bb9e317c2f9.tar.gz
chromium_src-a5c493b9b38dcb17d5e621e06a9c9bb9e317c2f9.tar.bz2
Clean up SpdyStream.
Removed a lot of duplicate/unnecessary logic. BUG=none TEST=none Review URL: http://codereview.chromium.org/3075023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_http_stream.cc32
-rw-r--r--net/spdy/spdy_http_stream.h2
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc3
-rw-r--r--net/spdy/spdy_session.cc10
-rw-r--r--net/spdy/spdy_session.h4
-rw-r--r--net/spdy/spdy_stream.cc162
-rw-r--r--net/spdy/spdy_stream.h38
-rw-r--r--net/spdy/spdy_stream_unittest.cc2
8 files changed, 97 insertions, 156 deletions
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 3ba777a..5cde9ed 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -196,28 +196,30 @@ uint64 SpdyHttpStream::GetUploadProgress() const {
}
int SpdyHttpStream::ReadResponseHeaders(CompletionCallback* callback) {
- DCHECK(stream_->is_idle());
- // Note: The SpdyStream may have already received the response headers, so
- // this call may complete synchronously.
CHECK(callback);
+ CHECK(!stream_->cancelled());
- if (stream_->response_complete())
+ if (stream_->closed())
return stream_->response_status();
- int result = stream_->DoReadResponseHeaders();
- if (result == ERR_IO_PENDING) {
- CHECK(!user_callback_);
- user_callback_ = callback;
+ // Check if we already have the response headers. If so, return synchronously.
+ if(stream_->response_received()) {
+ CHECK(stream_->is_idle());
+ return OK;
}
- return result;
+
+ // Still waiting for the response, return IO_PENDING.
+ CHECK(!user_callback_);
+ user_callback_ = callback;
+ return ERR_IO_PENDING;
}
int SpdyHttpStream::ReadResponseBody(
IOBuffer* buf, int buf_len, CompletionCallback* callback) {
+ CHECK(stream_->is_idle());
CHECK(buf);
CHECK(buf_len);
CHECK(callback);
- DCHECK(stream_->is_idle());
// If we have data buffered, complete the IO immediately.
if (!response_body_.empty()) {
@@ -240,7 +242,7 @@ int SpdyHttpStream::ReadResponseBody(
bytes_read += bytes_to_copy;
}
return bytes_read;
- } else if (stream_->response_complete()) {
+ } else if (stream_->closed()) {
return stream_->response_status();
}
@@ -286,7 +288,7 @@ int SpdyHttpStream::SendRequest(const std::string& /*headers_string*/,
CHECK(!stream_->cancelled());
CHECK(response);
- if (!stream_->pushed() && stream_->response_complete()) {
+ if (!stream_->pushed() && stream_->closed()) {
if (stream_->response_status() == OK)
return ERR_FAILED;
else
@@ -309,7 +311,7 @@ int SpdyHttpStream::SendRequest(const std::string& /*headers_string*/,
response_info_ = response;
bool has_upload_data = request_body_stream_.get() != NULL;
- int result = stream_->DoSendRequest(has_upload_data);
+ int result = stream_->SendRequest(has_upload_data);
if (result == ERR_IO_PENDING) {
CHECK(!user_callback_);
user_callback_ = callback;
@@ -379,7 +381,7 @@ void SpdyHttpStream::OnDataReceived(const char* data, int length) {
// Note that data may be received for a SpdyStream prior to the user calling
// ReadResponseBody(), therefore user_buffer_ may be NULL. This may often
// happen for server initiated streams.
- if (length > 0 && !stream_->response_complete()) {
+ if (length > 0 && !stream_->closed()) {
// Save the received data.
IOBufferWithSize* io_buffer = new IOBufferWithSize(length);
memcpy(io_buffer->data(), data, length);
@@ -433,7 +435,7 @@ void SpdyHttpStream::ScheduleBufferedReadCallback() {
// the caller. Returns true if we should wait, false otherwise.
bool SpdyHttpStream::ShouldWaitForMoreBufferedData() const {
// If the response is complete, there is no point in waiting.
- if (stream_->response_complete())
+ if (stream_->closed())
return false;
int bytes_buffered = 0;
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h
index 95134fa..066ed8c 100644
--- a/net/spdy/spdy_http_stream.h
+++ b/net/spdy/spdy_http_stream.h
@@ -68,7 +68,7 @@ class SpdyHttpStream : public SpdyStream::Delegate, public HttpStream {
// Indicates if the response body has been completely read.
virtual bool IsResponseBodyComplete() const {
- return stream_->response_complete();
+ return stream_->closed();
}
// With SPDY the end of response is always detectable.
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 224f98b..8072ce2 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -940,6 +940,7 @@ TEST_P(SpdyNetworkTransactionTest, ThreeGetsWithMaxConcurrentDelete) {
EXPECT_EQ(8U, data->read_index());
const HttpResponseInfo* response1 = trans1->GetResponseInfo();
+ ASSERT_TRUE(response1 != NULL);
EXPECT_TRUE(response1->headers != NULL);
EXPECT_TRUE(response1->was_fetched_via_spdy);
out.status_line = response1->headers->GetStatusLine();
@@ -950,6 +951,7 @@ TEST_P(SpdyNetworkTransactionTest, ThreeGetsWithMaxConcurrentDelete) {
EXPECT_EQ("hello!hello!", out.response_data);
const HttpResponseInfo* response2 = trans2->GetResponseInfo();
+ ASSERT_TRUE(response2 != NULL);
out.status_line = response2->headers->GetStatusLine();
out.response_info = *response2;
out.rv = ReadTransaction(trans2.get(), &out.response_data);
@@ -1349,6 +1351,7 @@ TEST_P(SpdyNetworkTransactionTest, ResponseWithTwoSynReplies) {
EXPECT_EQ(OK, rv);
const HttpResponseInfo* response = trans->GetResponseInfo();
+ ASSERT_TRUE(response != NULL);
EXPECT_TRUE(response->headers != NULL);
EXPECT_TRUE(response->was_fetched_via_spdy);
std::string response_data;
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 4f6504d..2dd2735 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -1022,8 +1022,8 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame,
}
unclaimed_pushed_streams_[path] = stream;
- // Activate a stream and parse the headers.
ActivateStream(stream);
+ stream->set_response_received();
// Parse the headers.
if (!Respond(*headers, stream))
@@ -1054,12 +1054,12 @@ void SpdySession::OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
CHECK_EQ(stream->stream_id(), stream_id);
CHECK(!stream->cancelled());
- if (stream->syn_reply_received()) {
+ if (stream->response_received()) {
LOG(WARNING) << "Received duplicate SYN_REPLY for stream " << stream_id;
CloseStream(stream->stream_id(), ERR_SPDY_PROTOCOL_ERROR);
return;
}
- stream->set_syn_reply_received();
+ stream->set_response_received();
const BoundNetLog& log = stream->net_log();
if (log.HasListener()) {
@@ -1125,12 +1125,12 @@ void SpdySession::OnControl(const spdy::SpdyControlFrame* frame) {
void SpdySession::OnRst(const spdy::SpdyRstStreamControlFrame& frame) {
spdy::SpdyStreamId stream_id = frame.stream_id();
- LOG(INFO) << "Spdy Fin for stream " << stream_id;
+ LOG(INFO) << "Spdy RST for stream " << stream_id;
bool valid_stream = IsStreamActive(stream_id);
if (!valid_stream) {
// NOTE: it may just be that the stream was cancelled.
- LOG(WARNING) << "Received FIN for invalid stream" << stream_id;
+ LOG(WARNING) << "Received RST for invalid stream" << stream_id;
return;
}
scoped_refptr<SpdyStream> stream = active_streams_[stream_id];
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 68094d7..72e8c06 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -296,10 +296,6 @@ class SpdySession : public base::RefCounted<SpdySession>,
// yet been satisfied
PendingCreateStreamQueue create_stream_queues_[NUM_PRIORITIES];
- // TODO(mbelshe): We need to track these stream lists better.
- // I suspect it is possible to remove a stream from
- // one list, but not the other.
-
// Map from stream id to all active streams. Streams are active in the sense
// that they have a consumer (typically SpdyNetworkTransaction and regardless
// of whether or not there is currently any ongoing IO [might be waiting for
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index fb5692a4..0204db6 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -20,12 +20,11 @@ SpdyStream::SpdyStream(
send_window_size_(spdy::kInitialWindowSize),
pushed_(pushed),
metrics_(Singleton<BandwidthMetrics>::get()),
- syn_reply_received_(false),
+ response_received_(false),
session_(session),
delegate_(NULL),
request_time_(base::Time::Now()),
response_(new spdy::SpdyHeaderBlock),
- response_complete_(false),
io_state_(STATE_NONE),
response_status_(OK),
cancelled_(false),
@@ -42,7 +41,7 @@ void SpdyStream::SetDelegate(Delegate* delegate) {
delegate_ = delegate;
if (pushed_) {
- CHECK(!response_->empty());
+ CHECK(response_received());
MessageLoop::current()->PostTask(
FROM_HERE, NewRunnableMethod(this,
&SpdyStream::PushedStreamReplayData));
@@ -72,7 +71,7 @@ void SpdyStream::PushedStreamReplayData() {
void SpdyStream::DetachDelegate() {
delegate_ = NULL;
- if (!response_complete_)
+ if (!closed())
Cancel();
}
@@ -115,7 +114,7 @@ void SpdyStream::IncreaseSendWindowSize(int delta_window_size) {
// If the stream was stalled due to consumed window size, restart the
// I/O loop.
- if (!response_complete_ && !delegate_->IsFinishedSendingBody()) {
+ if (!closed() && !delegate_->IsFinishedSendingBody()) {
// Don't start the I/O loop for every WINDOW_UPDATE frame received,
// since we may receive many of them before the "write" due to first
// received WINDOW_UPDATE is completed.
@@ -154,8 +153,7 @@ void SpdyStream::SetRequestTime(base::Time t) {
int SpdyStream::OnResponseReceived(const spdy::SpdyHeaderBlock& response) {
int rv = OK;
- LOG(INFO) << "OnResponseReceived";
- DCHECK_NE(io_state_, STATE_OPEN);
+ LOG(INFO) << "Received response for stream " << stream_id_;
metrics_.StartStream();
@@ -165,17 +163,14 @@ int SpdyStream::OnResponseReceived(const spdy::SpdyHeaderBlock& response) {
recv_first_byte_time_ = base::TimeTicks::Now();
response_time_ = base::Time::Now();
- if (io_state_ == STATE_NONE) {
- CHECK(pushed_);
- io_state_ = STATE_READ_HEADERS;
- } else if (io_state_ == STATE_READ_HEADERS_COMPLETE) {
- CHECK(!pushed_);
- } else {
- // We're not expecting a response while in this state. Error!
- rv = ERR_SPDY_PROTOCOL_ERROR;
- }
+ // If we receive a response before we are in STATE_WAITING_FOR_RESPONSE, then
+ // the server has sent the SYN_REPLY too early.
+ if (!pushed_ && io_state_ != STATE_WAITING_FOR_RESPONSE)
+ return ERR_SPDY_PROTOCOL_ERROR;
+ if (pushed_)
+ CHECK(io_state_ == STATE_NONE);
+ io_state_ = STATE_OPEN;
- rv = DoLoop(rv);
if (delegate_)
rv = delegate_->OnResponseReceived(*response_, response_time_, rv);
// If delegate_ is not yet attached, we'll call OnResponseReceived after the
@@ -202,12 +197,12 @@ void SpdyStream::OnDataReceived(const char* data, int length) {
return;
}
- CHECK(!response_complete_);
+ CHECK(!closed());
// If we don't have a response, then the SYN_REPLY did not come through.
// We cannot pass data up to the caller unless the reply headers have been
// received.
- if (response_->empty()) {
+ if (!response_received()) {
session_->CloseStream(stream_id_, ERR_SYN_REPLY_NOT_RECEIVED);
return;
}
@@ -238,26 +233,18 @@ void SpdyStream::OnDataReceived(const char* data, int length) {
delegate_->OnDataReceived(data, length);
}
-void SpdyStream::OnWriteComplete(int status) {
- // TODO(mbelshe): Check for cancellation here. If we're cancelled, we
- // should discontinue the DoLoop.
-
- // Clear it just in case this write lead to a 0 size send window, so that
- // incoming window updates will cause a write to be scheduled again.
+// This function is only called when an entire frame is written.
+void SpdyStream::OnWriteComplete(int bytes) {
window_update_write_pending_ = false;
-
- // It is possible that this stream was closed while we had a write pending.
- if (response_complete_)
+ DCHECK_LE(0, bytes);
+ send_bytes_ += bytes;
+ if (cancelled() || closed())
return;
-
- if (status > 0)
- send_bytes_ += status;
-
- DoLoop(status);
+ DoLoop(bytes);
}
void SpdyStream::OnClose(int status) {
- response_complete_ = true;
+ io_state_ = STATE_DONE;
response_status_ = status;
Delegate* delegate = delegate_;
delegate_ = NULL;
@@ -274,53 +261,20 @@ void SpdyStream::Cancel() {
session_->ResetStream(stream_id_, spdy::CANCEL);
}
-int SpdyStream::DoSendRequest(bool has_upload_data) {
- CHECK(!cancelled_);
-
- if (!pushed_) {
- spdy::SpdyControlFlags flags = spdy::CONTROL_FLAG_NONE;
- if (!has_upload_data)
- flags = spdy::CONTROL_FLAG_FIN;
-
- CHECK(request_.get());
- int result = session_->WriteSynStream(
- stream_id_, static_cast<RequestPriority>(priority_), flags,
- request_);
- if (result != ERR_IO_PENDING)
- return result;
- }
-
- send_time_ = base::TimeTicks::Now();
-
- int result = OK;
- if (!pushed_) {
- DCHECK_EQ(io_state_, STATE_NONE);
- io_state_ = STATE_SEND_HEADERS;
- } else {
- // Pushed stream should not have upload data.
- DCHECK(!has_upload_data);
- DCHECK(!response_->empty());
- DCHECK_EQ(io_state_, STATE_OPEN);
+int SpdyStream::SendRequest(bool has_upload_data) {
+ // Pushed streams do not send any data, and should always be in STATE_OPEN or
+ // STATE_DONE. However, we still want to return IO_PENDING to mimic non-push
+ // behavior.
+ has_upload_data_ = has_upload_data;
+ if (pushed_) {
+ send_time_ = base::TimeTicks::Now();
+ DCHECK(!has_upload_data_);
+ DCHECK(response_received());
return ERR_IO_PENDING;
}
- return DoLoop(result);
-}
-
-int SpdyStream::DoReadResponseHeaders() {
- CHECK(!cancelled_);
-
- // The SYN_REPLY has already been received.
- if (!response_->empty()) {
- CHECK_EQ(STATE_OPEN, io_state_);
- return OK;
- } else {
- CHECK_EQ(STATE_NONE, io_state_);
- }
-
-
- io_state_ = STATE_READ_HEADERS;
- // Q: do we need to run DoLoop here?
- return ERR_IO_PENDING;
+ CHECK_EQ(STATE_NONE, io_state_);
+ io_state_ = STATE_SEND_HEADERS;
+ return DoLoop(OK);
}
int SpdyStream::WriteStreamData(IOBuffer* data, int length,
@@ -337,7 +291,7 @@ int SpdyStream::DoLoop(int result) {
State state = io_state_;
io_state_ = STATE_NONE;
switch (state) {
- // State machine 1: Send headers and wait for response headers.
+ // State machine 1: Send headers and body.
case STATE_SEND_HEADERS:
CHECK_EQ(OK, result);
net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS, NULL);
@@ -356,16 +310,12 @@ int SpdyStream::DoLoop(int result) {
net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY, NULL);
result = DoSendBodyComplete(result);
break;
- case STATE_READ_HEADERS:
- CHECK_EQ(OK, result);
- net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL);
- result = DoReadHeaders();
- break;
- case STATE_READ_HEADERS_COMPLETE:
- net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL);
- result = DoReadHeadersComplete(result);
+ // This is an intermediary waiting state. This state is reached when all
+ // data has been sent, but no data has been received.
+ case STATE_WAITING_FOR_RESPONSE:
+ io_state_ = STATE_WAITING_FOR_RESPONSE;
+ result = ERR_IO_PENDING;
break;
-
// State machine 2: connection is established.
// In STATE_OPEN, OnResponseReceived has already been called.
// OnDataReceived, OnClose and OnWriteCompelte can be called.
@@ -398,12 +348,20 @@ int SpdyStream::DoLoop(int result) {
}
int SpdyStream::DoSendHeaders() {
- // The SpdySession will always call us back when the send is complete.
- // TODO(willchan): This code makes the assumption that for the non-push stream
- // case, the client code calls SendRequest() after creating the stream and
- // before yielding back to the MessageLoop. This is true in the current code,
- // but is not obvious from the headers. We should make the code handle
- // SendRequest() being called after the SYN_REPLY has been received.
+ CHECK(!cancelled_);
+
+ spdy::SpdyControlFlags flags = spdy::CONTROL_FLAG_NONE;
+ if (!has_upload_data_)
+ flags = spdy::CONTROL_FLAG_FIN;
+
+ CHECK(request_.get());
+ int result = session_->WriteSynStream(
+ stream_id_, static_cast<RequestPriority>(priority_), flags,
+ request_);
+ if (result != ERR_IO_PENDING)
+ return result;
+
+ send_time_ = base::TimeTicks::Now();
io_state_ = STATE_SEND_HEADERS_COMPLETE;
return ERR_IO_PENDING;
}
@@ -419,7 +377,7 @@ int SpdyStream::DoSendHeadersComplete(int result) {
// There is no body, skip that state.
if (delegate_->OnSendHeadersComplete(result)) {
- io_state_ = STATE_READ_HEADERS;
+ io_state_ = STATE_WAITING_FOR_RESPONSE;
return OK;
}
@@ -454,21 +412,11 @@ int SpdyStream::DoSendBodyComplete(int result) {
if (!delegate_->IsFinishedSendingBody())
io_state_ = STATE_SEND_BODY;
else
- io_state_ = STATE_READ_HEADERS;
+ io_state_ = STATE_WAITING_FOR_RESPONSE;
return OK;
}
-int SpdyStream::DoReadHeaders() {
- io_state_ = STATE_READ_HEADERS_COMPLETE;
- return !response_->empty() ? OK : ERR_IO_PENDING;
-}
-
-int SpdyStream::DoReadHeadersComplete(int result) {
- io_state_ = STATE_OPEN;
- return result;
-}
-
int SpdyStream::DoOpen(int result) {
if (delegate_)
delegate_->OnDataSent(result);
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 1745867..4f315db 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -53,8 +53,8 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
// Returns true if no more data to be sent.
virtual bool IsFinishedSendingBody() = 0;
- // Called when SYN_REPLY received. |status| indicates network error.
- // Returns network error code.
+ // Called when SYN_STREAM or SYN_REPLY received. |status| indicates network
+ // error. Returns network error code.
virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response,
base::Time response_time,
int status) = 0;
@@ -95,8 +95,8 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
spdy::SpdyStreamId stream_id() const { return stream_id_; }
void set_stream_id(spdy::SpdyStreamId stream_id) { stream_id_ = stream_id; }
- bool syn_reply_received() const { return syn_reply_received_; }
- void set_syn_reply_received() { syn_reply_received_ = true; }
+ bool response_received() const { return response_received_; }
+ void set_response_received() { response_received_ = true; }
// For pushed streams, we track a path to identify them.
const std::string& path() const { return path_; }
@@ -126,10 +126,8 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
base::Time GetRequestTime() const;
void SetRequestTime(base::Time t);
- // Called by the SpdySession when a response (e.g. a SYN_REPLY) has been
- // received for this stream. |path| is the path of the URL for a server
- // initiated stream, otherwise is empty.
- // Returns a status code.
+ // Called by the SpdySession when a response (e.g. a SYN_STREAM or SYN_REPLY)
+ // has been received for this stream. Returns a status code.
int OnResponseReceived(const spdy::SpdyHeaderBlock& response);
// Called by the SpdySession when response data has been received for this
@@ -145,7 +143,7 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
// will be called multiple times for each write which completes. Writes
// include the SYN_STREAM write and also DATA frame writes.
// |result| is the number of bytes written or a net error code.
- void OnWriteComplete(int status);
+ void OnWriteComplete(int bytes);
// Called by the SpdySession when the request is finished. This callback
// will always be called at the end of the request and signals to the
@@ -156,18 +154,13 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
void Cancel();
bool cancelled() const { return cancelled_; }
+ bool closed() const { return io_state_ == STATE_DONE; }
// Interface for Spdy[Http|WebSocket]Stream to use.
// Sends the request.
// For non push stream, it will send SYN_STREAM frame.
- int DoSendRequest(bool has_upload_data);
-
- // Reads response headers. If the SpdyStream have already received
- // the response headers, return OK and response headers filled in
- // |response| given in SendRequest.
- // Otherwise, return ERR_IO_PENDING and OnResponseReceived() will be called.
- int DoReadResponseHeaders();
+ int SendRequest(bool has_upload_data);
// Sends DATA frame.
int WriteStreamData(IOBuffer* data, int length,
@@ -176,9 +169,9 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
bool GetSSLInfo(SSLInfo* ssl_info, bool* was_npn_negotiated);
bool is_idle() const {
- return io_state_ == STATE_NONE || io_state_ == STATE_OPEN;
+ return io_state_ == STATE_OPEN || io_state_ == STATE_DONE;
}
- bool response_complete() const { return response_complete_; }
+
int response_status() const { return response_status_; }
private:
@@ -188,8 +181,7 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
STATE_SEND_HEADERS_COMPLETE,
STATE_SEND_BODY,
STATE_SEND_BODY_COMPLETE,
- STATE_READ_HEADERS,
- STATE_READ_HEADERS_COMPLETE,
+ STATE_WAITING_FOR_RESPONSE,
STATE_OPEN,
STATE_DONE
};
@@ -233,7 +225,7 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
const bool pushed_;
ScopedBandwidthMetrics metrics_;
- bool syn_reply_received_;
+ bool response_received_;
scoped_refptr<SpdySession> session_;
@@ -250,14 +242,14 @@ class SpdyStream : public base::RefCounted<SpdyStream> {
linked_ptr<spdy::SpdyHeaderBlock> response_;
base::Time response_time_;
- bool response_complete_; // TODO(mbelshe): fold this into the io_state.
State io_state_;
// Since we buffer the response, we also buffer the response status.
- // Not valid until response_complete_ is true.
+ // Not valid until the stream is closed.
int response_status_;
bool cancelled_;
+ bool has_upload_data_;
BoundNetLog net_log_;
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 03a5180..64abcc1 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -221,7 +221,7 @@ TEST_F(SpdyStreamTest, SendDataAfterOpen) {
(*headers)["version"] = "HTTP/1.1";
stream->set_spdy_headers(headers);
- EXPECT_EQ(ERR_IO_PENDING, stream->DoSendRequest(true));
+ EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(true));
EXPECT_EQ(OK, callback.WaitForResult());