Skip to content

Commit a3fcef3

Browse files
authored
Merge pull request #514 from wazuh/merge-4.14.0-into-4.14.1
Merge 4.14.0 into 4.14.1
2 parents 474b1c8 + fd1ee34 commit a3fcef3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/wazuh_testing/tools/simulators/remoted_simulator.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def __init__(self,
6868
self.last_message_ctx = {}
6969
self.request_counter = 0
7070

71+
self._queue_response_req_message = Queue()
72+
7173
# Properties
7274

7375
@property
@@ -133,9 +135,12 @@ def send_custom_message(self, message: Union[str, bytes]) -> None:
133135
if not isinstance(message, bytes):
134136
message = message.encode()
135137

136-
self.custom_message = message
138+
with self._queue_response_req_message.mutex:
139+
self._queue_response_req_message.queue.clear()
137140
self.custom_message_sent = False
138141

142+
self.custom_message = message
143+
139144
# Internal methods.
140145

141146
def __remoted_response_simulation(self, request: Any) -> bytes:
@@ -176,9 +181,13 @@ def __remoted_response_simulation(self, request: Any) -> bytes:
176181
elif '#!-agent shutdown' in message:
177182
self.__mitm.event.set()
178183
response = _RESPONSE_SHUTDOWN
184+
elif '#!-req' in message:
185+
self._queue_response_req_message.put(message)
186+
response = _RESPONSE_EMPTY
179187
elif self.custom_message and not self.custom_message_sent:
180188
response = self.custom_message
181189
self.custom_message_sent = True
190+
self.custom_message = None
182191
elif '#!-' in message:
183192
response = _RESPONSE_ACK
184193
else:

0 commit comments

Comments
 (0)