Spaces:
Running
Running
Commit
·
5dac619
1
Parent(s):
81b9358
Testing Changes
Browse files
FileStream/bot/__init__.py
CHANGED
@@ -28,7 +28,4 @@ async def req_client(PUBLIC_IP:str)-> dict:
|
|
28 |
index = min(WORK_LOADS, key=WORK_LOADS.get)
|
29 |
faster_client = MULTI_CLIENTS[index]
|
30 |
print("WorkLoads :",WORK_LOADS)
|
31 |
-
#print("\n \nFaster Client",faster_client,type(faster_client),"\nWORK_LOADS",WORK_LOADS,type(WORK_LOADS),"\nMULTI_CLIENTS",MULTI_CLIENTS,type(MULTI_CLIENTS),"\n")
|
32 |
-
#ACTIVE_CLIENTS.update(faster_client)
|
33 |
-
#response = dict(index=index,public_ip=PUBLIC_IP, client=faster_client)
|
34 |
return dict(index=index,public_ip=PUBLIC_IP, client=faster_client)
|
|
|
28 |
index = min(WORK_LOADS, key=WORK_LOADS.get)
|
29 |
faster_client = MULTI_CLIENTS[index]
|
30 |
print("WorkLoads :",WORK_LOADS)
|
|
|
|
|
|
|
31 |
return dict(index=index,public_ip=PUBLIC_IP, client=faster_client)
|
FileStream/server/Functions/downloader.py
CHANGED
@@ -23,25 +23,26 @@ async def media_streamer(request: web.Request, db_id: str, speed: str):
|
|
23 |
# Get the Range header from the request, default to 0 if not present
|
24 |
range_header = request.headers.get("Range", 0)
|
25 |
Worker = await req_client(request.remote)
|
26 |
-
client=Worker.get("client")
|
27 |
# Log client info if multi-client mode
|
28 |
|
29 |
-
if Telegram.MULTI_CLIENT:
|
30 |
#print("ACTIVE Client",ACTIVE_CLIENTS)
|
31 |
-
logging.info(f"Client {Worker['index']} is now serving {request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
32 |
|
33 |
# Use an existing ByteStreamer or create a new one
|
34 |
#tg_connect = ACTIVE_CLIENTS.get(client['client'], None)
|
35 |
|
36 |
if client in ACTIVE_CLIENTS:
|
37 |
-
logging.debug(f"
|
38 |
tg_connect = ACTIVE_CLIENTS[client]
|
39 |
|
40 |
else:
|
41 |
tg_connect = utils.ByteStreamer(client)
|
42 |
ACTIVE_CLIENTS[client] = tg_connect
|
43 |
-
logging.debug(f"
|
44 |
|
|
|
45 |
tg_connect.update_last_activity()
|
46 |
|
47 |
try:
|
|
|
23 |
# Get the Range header from the request, default to 0 if not present
|
24 |
range_header = request.headers.get("Range", 0)
|
25 |
Worker = await req_client(request.remote)
|
26 |
+
client= Worker.get("client")
|
27 |
# Log client info if multi-client mode
|
28 |
|
29 |
+
#if Telegram.MULTI_CLIENT:
|
30 |
#print("ACTIVE Client",ACTIVE_CLIENTS)
|
31 |
+
#logging.info(f"Client {Worker['index']} is now serving {request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
32 |
|
33 |
# Use an existing ByteStreamer or create a new one
|
34 |
#tg_connect = ACTIVE_CLIENTS.get(client['client'], None)
|
35 |
|
36 |
if client in ACTIVE_CLIENTS:
|
37 |
+
logging.debug(f"Cached ByteStreamer object for client {Worker['index']} # Serving Destination :{request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
38 |
tg_connect = ACTIVE_CLIENTS[client]
|
39 |
|
40 |
else:
|
41 |
tg_connect = utils.ByteStreamer(client)
|
42 |
ACTIVE_CLIENTS[client] = tg_connect
|
43 |
+
logging.debug(f"New ByteStreamer object for client {Worker['index']} # Serving Destination :{request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
44 |
|
45 |
+
logging.info(f"Client :{Worker['index']} # Serving Destination : {request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
46 |
tg_connect.update_last_activity()
|
47 |
|
48 |
try:
|