force register_server requests to go throut IPv4

This commit is contained in:
clore 2024-09-08 22:00:57 +00:00
parent 6150cf48cb
commit 2d1c15c7bf
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ from lib import logging as logging_lib
from lib import get_specs from lib import get_specs
from lib import utils from lib import utils
import threading import threading
import socket
import aiohttp import aiohttp
import asyncio import asyncio
import json import json
@ -47,7 +48,9 @@ async def register_server(data):
"Content-Type": "application/json" "Content-Type": "application/json"
} }
async with aiohttp.ClientSession() as session: connector = aiohttp.TCPConnector(family=socket.AF_INET)
async with aiohttp.ClientSession(connector=connector) as session:
try: try:
async with session.post(url, data=json_data, headers=headers, timeout=15) as response: async with session.post(url, data=json_data, headers=headers, timeout=15) as response:
if response.status == 200: if response.status == 200: