From 67b4fa97a889f54d3f62c1766428b613f87f8e1f Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Wed, 9 May 2012 09:57:04 -0400 Subject: [PATCH] bug 752648 - identify failed ssl handshakes earlier to improve restart logic r=honzab --- netwerk/protocol/http/nsHttpConnection.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index d81b9922993b..4ceb5b36e8fe 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -309,8 +309,13 @@ nsHttpConnection::EnsureNPNComplete() PRUint32 count = 0; rv = mSocketOut->Write("", 0, &count); - if (NS_FAILED(rv) && rv != NS_BASE_STREAM_WOULD_BLOCK) + if (NS_FAILED(rv) && rv != NS_BASE_STREAM_WOULD_BLOCK) { + LOG(("nsHttpConnection::EnsureNPNComplete %p socket write failed " + "with result %X\n", this, rv)); + mSocketOutCondition = rv; goto npnComplete; + } + return false; } @@ -1247,7 +1252,14 @@ nsHttpConnection::OnSocketWritable() LOG((" writing transaction request stream\n")); mProxyConnectInProgress = false; - rv = mTransaction->ReadSegments(this, nsIOService::gDefaultSegmentSize, &n); + + if (NS_SUCCEEDED(mSocketOutCondition) || + mSocketOutCondition == NS_BASE_STREAM_WOULD_BLOCK) { + rv = mTransaction->ReadSegments(this, nsIOService::gDefaultSegmentSize, &n); + } + else { + rv = mSocketOutCondition; + } } LOG((" ReadSegments returned [rv=%x read=%u sock-cond=%x]\n",