In some use cases the connections always time out before being re-used.
This allows those use cases to disable this and avoid errors from trying to
use the timed out connection.
... | ... |
@@ -206,6 +206,7 @@ class Config(object): |
206 | 206 |
# s3 will timeout if a request/transfer is stuck for more than a short time |
207 | 207 |
throttle_max = 100 |
208 | 208 |
public_url_use_https = False |
209 |
+ connection_pooling = True |
|
209 | 210 |
|
210 | 211 |
## Creating a singleton |
211 | 212 |
def __new__(self, configfile = None, access_key=None, secret_key=None, access_token=None): |
... | ... |
@@ -268,6 +268,12 @@ class ConnMan(object): |
268 | 268 |
debug("ConnMan.put(): closing over-used connection") |
269 | 269 |
return |
270 | 270 |
|
271 |
+ cfg = Config() |
|
272 |
+ if not cfg.connection_pooling: |
|
273 |
+ ConnMan.close(conn) |
|
274 |
+ debug("ConnMan.put(): closing connection (connection pooling disabled)") |
|
275 |
+ return |
|
276 |
+ |
|
271 | 277 |
ConnMan.conn_pool_sem.acquire() |
272 | 278 |
ConnMan.conn_pool[conn.id].append(conn) |
273 | 279 |
ConnMan.conn_pool_sem.release() |
... | ... |
@@ -2761,6 +2761,7 @@ def main(): |
2761 | 2761 |
optparser.add_option( "--no-check-hostname", dest="check_ssl_hostname", action="store_false", help="Do not check SSL certificate hostname validity") |
2762 | 2762 |
optparser.add_option( "--signature-v2", dest="signature_v2", action="store_true", help="Use AWS Signature version 2 instead of newer signature methods. Helpful for S3-like systems that don't have AWS Signature v4 yet.") |
2763 | 2763 |
optparser.add_option( "--limit-rate", dest="limitrate", action="store", type="string", help="Limit the upload or download speed to amount bytes per second. Amount may be expressed in bytes, kilobytes with the k suffix, or megabytes with the m suffix") |
2764 |
+ optparser.add_option( "--no-connection-pooling", dest="connection_pooling", action="store_false", help="Disable connection re-use") |
|
2764 | 2765 |
optparser.add_option( "--requester-pays", dest="requester_pays", action="store_true", help="Set the REQUESTER PAYS flag for operations") |
2765 | 2766 |
optparser.add_option("-l", "--long-listing", dest="long_listing", action="store_true", help="Produce long listing [ls]") |
2766 | 2767 |
optparser.add_option( "--stop-on-error", dest="stop_on_error", action="store_true", help="stop if error in transfer") |