mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Extra connection evaluation before putting it back to the pool
Use `urllib3.util.is_connection_dropped` to check that the connection is fine before putting it back to the pool to be reused later.
This commit is contained in:
parent
9a797fe612
commit
3bb9355662
@ -64,6 +64,7 @@ import urlcanon
|
|||||||
import time
|
import time
|
||||||
import collections
|
import collections
|
||||||
import cProfile
|
import cProfile
|
||||||
|
from urllib3.util import is_connection_dropped
|
||||||
|
|
||||||
class ProxyingRecorder(object):
|
class ProxyingRecorder(object):
|
||||||
"""
|
"""
|
||||||
@ -456,7 +457,7 @@ class MitmProxyHandler(http_server.BaseHTTPRequestHandler):
|
|||||||
# put it back in the pool to reuse it later.
|
# put it back in the pool to reuse it later.
|
||||||
if prox_rec_res:
|
if prox_rec_res:
|
||||||
prox_rec_res.close()
|
prox_rec_res.close()
|
||||||
if connection_is_fine:
|
if connection_is_fine and not is_connection_dropped(self._remote_server_conn):
|
||||||
self._conn_pool._put_conn(self._remote_server_conn)
|
self._conn_pool._put_conn(self._remote_server_conn)
|
||||||
else:
|
else:
|
||||||
self._remote_server_conn.sock.close()
|
self._remote_server_conn.sock.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user