REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.55 KB
Close
//opt/cloudlinux/venv/lib/python3.11/site-packages/ssa/agent.py
Text
Base64
# -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT """ This module contains contains classes implementing SSA Agent behaviour """ import atexit import json import logging from concurrent.futures import ThreadPoolExecutor from threading import current_thread from .internal.constants import agent_sock from .internal.exceptions import SSAError from .internal.utils import create_socket from .modules.processor import RequestProcessor # Maximum number of concurrent worker threads for handling requests. # Limits memory usage on high-traffic servers. MAX_WORKERS = 50 class SimpleAgent: """ SSA Simple Agent class """ def __init__(self): self.logger = logging.getLogger('agent') self.request_processor = RequestProcessor() self.executor = ThreadPoolExecutor(max_workers=MAX_WORKERS) atexit.register(self._shutdown) # start serving incoming connections self.listen() def _shutdown(self): """Gracefully shutdown the thread pool executor.""" self.executor.shutdown(wait=False) def listen(self) -> None: """ Start listening socket """ _socket = create_socket(agent_sock) while True: connection, address = _socket.accept() self.executor.submit(self.handle, connection) self.logger.debug('[ThreadPool] Submitted task') def handle(self, connection: 'socket object') -> None: """ Handle incoming connection :param connection: socket object usable to send and receive data on the connection """ fileobj = connection.makefile(errors='ignore') try: input_data = self.read_input(fileobj) self.request_processor.handle(input_data) except SSAError as e: self.logger.error('Handled exception in [%s]: %s', current_thread().name, str(e)) pass connection.close() def read_input(self, fileio: 'file object') -> dict: """ Read input data and return decoded json :param fileio: a file-like object providing read method """ data = fileio.read() self.logger.info('[%s] I received %i bytes: %s', current_thread().name, len(data.encode()), data) if data: return json.loads(data.strip(), strict=False) else: return {}
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 6 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
autotracing
DIR
-
drwxr-xr-x
2026-03-14 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
configuration
DIR
-
drwxr-xr-x
2026-03-14 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
internal
DIR
-
drwxr-xr-x
2026-03-14 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
modules
DIR
-
drwxr-xr-x
2026-03-14 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ssa_utils
DIR
-
drwxr-xr-x
2026-03-14 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__pycache__
DIR
-
drwxr-xr-x
2026-03-14 07:03:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
agent.py
2.55 KB
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
clos_ssa_ini.py
1.29 KB
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
cloudlinux-autotracing.py
382 B
lrwxr-xr-x
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
cloudlinux-ssa-agent.py
374 B
lrwxr-xr-x
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
cloudlinux-ssa-manager.py
378 B
lrwxr-xr-x
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
db.py
8.07 KB
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
manager.py
20.43 KB
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
website_isolation.py
8.39 KB
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
0 B
lrw-r--r--
2026-02-10 14:39:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).