diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 23:54:43 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 23:54:43 +0000 |
commit | 23c348d0f8ffbb7c96e16f5aee6512d7f1e99e86 (patch) | |
tree | b139ea56f137dde5fad20a9aed4ad715b0961eec /net/ocsp | |
parent | b25e06ba4e34b5e467f72522a035ff3626ff6183 (diff) | |
download | chromium_src-23c348d0f8ffbb7c96e16f5aee6512d7f1e99e86.zip chromium_src-23c348d0f8ffbb7c96e16f5aee6512d7f1e99e86.tar.gz chromium_src-23c348d0f8ffbb7c96e16f5aee6512d7f1e99e86.tar.bz2 |
Use begin() to iterate over requests_ (a std::set) while deleting items.
R=willchan@chromium.org
BUG=131549
TEST=to-do
Review URL: https://chromiumcodereview.appspot.com/10640014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ocsp')
-rw-r--r-- | net/ocsp/nss_ocsp.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index 23c00d0..fca6c3d 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -517,12 +517,10 @@ void OCSPIOLoop::RemoveRequest(OCSPRequestSession* request) { } void OCSPIOLoop::CancelAllRequests() { - std::set<OCSPRequestSession*> requests; - requests.swap(requests_); - - for (std::set<OCSPRequestSession*>::iterator it = requests.begin(); - it != requests.end(); ++it) - (*it)->CancelURLRequest(); + // CancelURLRequest() always removes the request from the requests_ + // set synchronously. + while (!requests_.empty()) + (*requests_.begin())->CancelURLRequest(); } OCSPNSSInitialization::OCSPNSSInitialization() { @@ -578,10 +576,11 @@ SECStatus OCSPCreateSession(const char* host, PRUint16 portnum, net::URLRequestContext* request_context = g_request_context; pthread_mutex_unlock(&g_request_context_lock); if (request_context == NULL) { - LOG(ERROR) << "No URLRequestContext for OCSP handler."; - // The application failed to call SetURLRequestContextForOCSP, so we - // can't create and use net::URLRequest. PR_NOT_IMPLEMENTED_ERROR is not an - // accurate error code for this error condition, but is close enough. + LOG(ERROR) << "No URLRequestContext for NSS HTTP handler. host: " << host; + // The application failed to call SetURLRequestContextForNSSHttpIO or + // has already called ShutdownNSSHttpIO, so we can't create and use + // net::URLRequest. PR_NOT_IMPLEMENTED_ERROR is not an accurate error + // code for these error conditions, but is close enough. PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); return SECFailure; } |