Skip to content

Commit

Permalink
compat with python3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbers committed May 8, 2022
1 parent 6e8e8b6 commit b268731
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mtprotoproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2287,21 +2287,21 @@ def create_servers(loop):
def create_utilitary_tasks(loop):
tasks = []

stats_printer_task = asyncio.Task(stats_printer())
stats_printer_task = asyncio.Task(stats_printer(), loop=loop)
tasks.append(stats_printer_task)

if config.USE_MIDDLE_PROXY:
middle_proxy_updater_task = asyncio.Task(update_middle_proxy_info())
middle_proxy_updater_task = asyncio.Task(update_middle_proxy_info(), loop=loop)
tasks.append(middle_proxy_updater_task)

if config.GET_TIME_PERIOD:
time_get_task = asyncio.Task(get_srv_time())
time_get_task = asyncio.Task(get_srv_time(), loop=loop)
tasks.append(time_get_task)

get_cert_len_task = asyncio.Task(get_mask_host_cert_len())
get_cert_len_task = asyncio.Task(get_mask_host_cert_len(), loop=loop)
tasks.append(get_cert_len_task)

clear_resolving_cache_task = asyncio.Task(clear_ip_resolving_cache())
clear_resolving_cache_task = asyncio.Task(clear_ip_resolving_cache(), loop=loop)
tasks.append(clear_resolving_cache_task)

return tasks
Expand All @@ -2323,9 +2323,10 @@ def main():

if sys.platform == "win32":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
else:
loop = asyncio.new_event_loop()

loop = asyncio.get_event_loop()
asyncio.set_event_loop(loop)
loop.set_exception_handler(loop_exception_handler)

utilitary_tasks = create_utilitary_tasks(loop)
Expand Down

0 comments on commit b268731

Please sign in to comment.