Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions multithread.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ socket_timeout=10
max_threads=8
threads_per_server=2
servers_per_repo=4
proxy_ip=None
proxy_port=0
14 changes: 11 additions & 3 deletions multithread.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ def init_hook(conduit):
@type threads_per_server : Integer
@param servers_per_repo : Most servers to select for a single repository
@type servers_per_repo : Integer
@param proxy_ip : Proxy IP address
@type proxy_ip : String
@param proxy_port : Proxy L4 port Number
@type proxy_port : Integer

"""
global verbose, socket_timeout, dl_timeout, max_threads
global verbose, socket_timeout, dl_timeout, max_threads, proxy_ip, proxy_port
global servers_per_repo, threads_per_server
if hasattr(conduit, 'registerPackageName'):
conduit.registerPackageName("yum-plugin-multithread")
Expand All @@ -95,6 +99,8 @@ def init_hook(conduit):
threads_per_server = conduit.confInt('main', 'threads_per_server',
default=4)
servers_per_repo = conduit.confInt('main', 'servers_per_repo', default=4)
proxy_ip = conduit.confString('main', 'proxy_ip', default='None')
proxy_port = conduit.confInt('main', 'proxy_port', default=0)

def predownload_hook(conduit):
"""
Expand Down Expand Up @@ -150,8 +156,7 @@ def __init__(self):
"""
This is the initiliazer function of the B{L{MultiThread}} class.
"""
global max_threads, socket_timeout, dl_timeout

global max_threads, socket_timeout, dl_timeout, proxy_ip, proxy_port
self.mc = pycurl.CurlMulti()
self.url_queue = dict()
self.npackages = 0
Expand All @@ -166,6 +171,9 @@ def __init__(self):
sc.setopt(pycurl.CONNECTTIMEOUT, socket_timeout)
sc.setopt(pycurl.TIMEOUT, dl_timeout)
sc.setopt(pycurl.NOSIGNAL, 1)
if proxy_ip != 'None' :
sc.setopt(pycurl.PROXY, proxy_ip)
sc.setopt(pycurl.PROXYPORT, proxy_port)
self.mc.handles.append(sc)

def add_package(self, remote, local) :
Expand Down