From e8cc3ca3d4ea868a971ae2479333a4e1807cf8be Mon Sep 17 00:00:00 2001 From: drebs Date: Sat, 2 Sep 2017 02:38:57 -0300 Subject: [feat] use a persistent connetion pool in http agent --- src/leap/soledad/client/_http.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/leap') diff --git a/src/leap/soledad/client/_http.py b/src/leap/soledad/client/_http.py index 101c61be..f6e2e28e 100644 --- a/src/leap/soledad/client/_http.py +++ b/src/leap/soledad/client/_http.py @@ -23,6 +23,7 @@ from twisted.internet import reactor from twisted.web.iweb import IAgent from twisted.web.client import Agent from twisted.web.client import CookieAgent +from twisted.web.client import HTTPConnectionPool from twisted.web.http_headers import Headers from cookielib import CookieJar @@ -57,7 +58,8 @@ class PinnedTokenAgent(Agent): self.set_token(token) # pin this agent with the platform TLS certificate factory = getPolicyForHTTPS(cert_file) - Agent.__init__(self, reactor, contextFactory=factory) + pool = HTTPConnectionPool(reactor, persistent=True) + Agent.__init__(self, reactor, contextFactory=factory, pool=pool) def set_token(self, token): self._token = token -- cgit v1.2.3