Chromium Code Reviews| Index: net/quic/bidirectional_stream_quic_impl.cc |
| diff --git a/net/quic/bidirectional_stream_quic_impl.cc b/net/quic/bidirectional_stream_quic_impl.cc |
| index 3d1ae3cd4b31020e8638845d9e2ab2494acc7b27..ef5f9de7d03bdc3e11153c1d317326658c9ebd97 100644 |
| --- a/net/quic/bidirectional_stream_quic_impl.cc |
| +++ b/net/quic/bidirectional_stream_quic_impl.cc |
| @@ -119,9 +119,16 @@ int BidirectionalStreamQuicImpl::ReadData(IOBuffer* buffer, int buffer_len) { |
| void BidirectionalStreamQuicImpl::SendData(const scoped_refptr<IOBuffer>& data, |
| int length, |
| bool end_stream) { |
| - DCHECK(stream_); |
| DCHECK(length > 0 || (length == 0 && end_stream)); |
| + if (!stream_) { |
| + LOG(ERROR) << "Trying to send data when stream has been destroyed."; |
|
mef
2016/06/01 21:53:15
when -> after
xunjieli
2016/06/01 23:08:22
Done.
|
| + base::ThreadTaskRunnerHandle::Get()->PostTask( |
| + FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::NotifyError, |
| + weak_factory_.GetWeakPtr(), ERR_UNEXPECTED)); |
|
mef
2016/06/01 21:53:15
nit: Should say ERR_UNEXPECTED in CL description.
xunjieli
2016/06/01 23:08:22
Done.
|
| + return; |
| + } |
| + |
| std::unique_ptr<QuicConnection::ScopedPacketBundler> bundler; |
| if (!has_sent_headers_) { |
| DCHECK(!send_request_headers_automatically_); |
| @@ -149,9 +156,16 @@ void BidirectionalStreamQuicImpl::SendvData( |
| const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| const std::vector<int>& lengths, |
| bool end_stream) { |
| - DCHECK(stream_); |
| DCHECK_EQ(buffers.size(), lengths.size()); |
| + if (!stream_) { |
| + LOG(ERROR) << "Trying to send data when stream has been destroyed."; |
|
mef
2016/06/01 21:53:15
when -> after
xunjieli
2016/06/01 23:08:22
Done.
|
| + base::ThreadTaskRunnerHandle::Get()->PostTask( |
| + FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::NotifyError, |
| + weak_factory_.GetWeakPtr(), ERR_UNEXPECTED)); |
| + return; |
| + } |
| + |
| QuicConnection::ScopedPacketBundler bundler( |
| session_->connection(), QuicConnection::SEND_ACK_IF_PENDING); |
| if (!has_sent_headers_) { |
| @@ -233,12 +247,12 @@ void BidirectionalStreamQuicImpl::OnDataAvailable() { |
| void BidirectionalStreamQuicImpl::OnClose(QuicErrorCode error) { |
| DCHECK(stream_); |
| + |
| if (error == QUIC_NO_ERROR && |
| stream_->stream_error() == QUIC_STREAM_NO_ERROR) { |
| ResetStream(); |
| return; |
| } |
| - ResetStream(); |
|
mef
2016/06/01 21:53:15
Why no longer ResetStream() here?
xunjieli
2016/06/01 23:08:22
It is redundant. NotifyError will call ResetStream
|
| NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR |
| : ERR_QUIC_HANDSHAKE_FAILED); |
| } |