From a25d4e7ca4e2887c5ce56a7564c38d174618e920 Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git@torproject.org>
Date: Fri, 7 Sep 2012 16:18:26 -0700
Subject: [PATCH 08/41] Provide an observer event to close persistent
 connections

We need to prevent linkability across "New Identity", which includes closing
keep-alive connections.
---
 netwerk/protocol/http/nsHttpHandler.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index d897a2c..e33ff08 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -312,6 +312,7 @@ nsHttpHandler::Init()
         mObserverService->AddObserver(this, "net:clear-active-logins", true);
         mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, true);
         mObserverService->AddObserver(this, "net:prune-dead-connections", true);
+        mObserverService->AddObserver(this, "net:prune-all-connections", true);
         mObserverService->AddObserver(this, "net:failed-to-process-uri-content", true);
     }
  
@@ -1576,6 +1577,12 @@ nsHttpHandler::Observe(nsISupports *subject,
         if (uri && mConnMgr)
             mConnMgr->ReportFailedToProcess(uri);
     }
+    else if (strcmp(topic, "net:prune-all-connections") == 0) {
+        if (mConnMgr) {
+           mConnMgr->ClosePersistentConnections();
+           mConnMgr->PruneDeadConnections();
+        }
+    }
   
     return NS_OK;
 }
-- 
1.8.1.2

