forked from p15670423/monkey
Agent: Use `create_daemon_thread` in ExploitClassHTTPServer
This commit is contained in:
parent
2aee4c0541
commit
943cb2fa7a
|
@ -3,6 +3,8 @@ import logging
|
|||
import threading
|
||||
from typing import Type
|
||||
|
||||
from infection_monkey.utils.threading import create_daemon_thread
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
HTTP_TOO_MANY_REQUESTS_ERROR_CODE = 429
|
||||
|
@ -32,12 +34,10 @@ class ExploitClassHTTPServer:
|
|||
HTTPHandler = _get_new_http_handler_class(java_class, self._class_downloaded)
|
||||
|
||||
self._server = http.server.HTTPServer((ip, port), HTTPHandler)
|
||||
# Setting `daemon=True` to save ourselves some trouble when this is merged to the
|
||||
# agent-refactor branch.
|
||||
# TODO: Make a call to `create_daemon_thread()` instead of calling the `Thread()`
|
||||
# constructor directly after merging to the agent-refactor branch.
|
||||
self._server_thread = threading.Thread(
|
||||
target=self._server.serve_forever, args=(self._poll_interval,), daemon=True
|
||||
self._server_thread = create_daemon_thread(
|
||||
target=self._server.serve_forever,
|
||||
name="ExploitClassHTTPServerThread",
|
||||
args=(self._poll_interval,),
|
||||
)
|
||||
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue