bug 1208114 - fix h2 connect tunnels r=hurley

This commit is contained in:
Patrick McManus 2015-10-07 12:55:07 -04:00
Родитель a0bff8fc6f
Коммит bfd706e3e8
4 изменённых файлов: 26 добавлений и 2 удалений

Просмотреть файл

@ -3189,7 +3189,8 @@ Http2Session::OnWriteSegment(char *buf,
return NS_ERROR_FAILURE;
}
if (mDownstreamState == NOT_USING_NETWORK) {
if (mDownstreamState == NOT_USING_NETWORK ||
mDownstreamState == BUFFERING_FRAME_HEADER) {
return NS_BASE_STREAM_WOULD_BLOCK;
}
@ -3271,6 +3272,7 @@ Http2Session::OnWriteSegment(char *buf,
return NS_OK;
}
MOZ_ASSERT(false);
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -324,8 +324,20 @@ Http2Stream::WriteSegments(nsAHttpSegmentWriter *writer,
// won't block other streams. but we should not advance the flow control window
// so that we'll eventually push back on the sender.
// with tunnels you need to make sure that this is an underlying connction established
// that can be meaningfully giving this signal
bool doBuffer = true;
if (mIsTunnel) {
nsRefPtr<SpdyConnectTransaction> qiTrans(mTransaction->QuerySpdyConnectTransaction());
if (qiTrans) {
doBuffer = qiTrans->ConnectedReadyForInput();
}
}
// stash this data
rv = BufferInput(count, countWritten);
if (doBuffer) {
rv = BufferInput(count, countWritten);
LOG3(("Http2Stream::WriteSegments %p Buffered %X %d\n", this, rv, *countWritten));
}
}
mSegmentWriter = nullptr;
return rv;

Просмотреть файл

@ -1263,6 +1263,12 @@ SpdyConnectTransaction::WriteSegments(nsAHttpSegmentWriter *writer,
return rv;
}
bool
SpdyConnectTransaction::ConnectedReadyForInput()
{
return mTunneledConn && mTunnelStreamIn->mCallback;
}
nsHttpRequestHead *
SpdyConnectTransaction::RequestHead()
{

Просмотреть файл

@ -201,6 +201,10 @@ public:
nsHttpRequestHead *RequestHead() override final;
void Close(nsresult reason) override final;
// ConnectedReadyForInput() tests whether the spdy connect transaction is attached to
// an nsHttpConnection that can properly deal with flow control, etc..
bool ConnectedReadyForInput();
private:
friend class InputStreamShim;
friend class OutputStreamShim;