summaryrefslogtreecommitdiff
blob: 7d91c66b13325ace6400bceaee4b6a15d4aea67b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From befcfaff647b1e09722d100fbf2dadcc22cfdc2b Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git@torproject.org>
Date: Wed, 1 Feb 2012 15:53:28 -0800
Subject: [PATCH 11/13] 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 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index f21598e..f3bf6af 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -321,6 +321,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", PR_TRUE);
     }
  
     return NS_OK;
@@ -1481,6 +1482,12 @@ nsHttpHandler::Observe(nsISupports *subject,
             mConnMgr->PruneDeadConnections();
         }
     }
+    else if (strcmp(topic, "net:prune-all-connections") == 0) {
+        if (mConnMgr) {
+           mConnMgr->ClosePersistentConnections();
+           mConnMgr->PruneDeadConnections();
+        }
+    }
   
     return NS_OK;
 }
-- 
1.7.5.4