From 965616c6f73e8e10c60e60a417f893b773a73e50 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 14 May 2019 13:15:44 +0300 Subject: [PATCH] Connection closed when needed --- monkey/infection_monkey/transport/http.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monkey/infection_monkey/transport/http.py b/monkey/infection_monkey/transport/http.py index 00ced7198..e54445d52 100644 --- a/monkey/infection_monkey/transport/http.py +++ b/monkey/infection_monkey/transport/http.py @@ -170,6 +170,8 @@ class HTTPServer(threading.Thread): def report_download(dest=None): LOG.info('File downloaded from (%s,%s)' % (dest[0], dest[1])) self.downloads += 1 + if not self.downloads < self.max_downloads: + self.close_connection = 1 httpd = BaseHTTPServer.HTTPServer((self._local_ip, self._local_port), TempHandler) httpd.timeout = 0.5 # this is irrelevant? @@ -214,6 +216,8 @@ class LockedHTTPServer(threading.Thread): def report_download(dest=None): LOG.info('File downloaded from (%s,%s)' % (dest[0], dest[1])) self.downloads += 1 + if not self.downloads < self.max_downloads: + self.close_connection = 1 httpd = BaseHTTPServer.HTTPServer((self._local_ip, self._local_port), TempHandler) self.lock.release()