diff options
author | Pavel Labath <labath@google.com> | 2018-02-01 11:29:06 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-02-01 11:29:06 +0000 |
commit | 71ad71e530d912bdbe1c93417beb73f10c72b6ce (patch) | |
tree | 7d403e58009d977cd3c2c4bd0d6ebb04ade2d21c /lldb/packages/Python/lldbsuite/test/functionalities | |
parent | 17c4633e7faf76682e7c999576128848b10fb815 (diff) | |
download | bcm5719-llvm-71ad71e530d912bdbe1c93417beb73f10c72b6ce.tar.gz bcm5719-llvm-71ad71e530d912bdbe1c93417beb73f10c72b6ce.zip |
mock_gdb_server: rectify ack handling code
The mock server was sending acks back in response to spurious acks from
the client, but the client was not prepared to handle these. Most of the
time this would work because the only time the client was sending
unsolicited acks is after the initial connection, and there reply-ack
would get ignored in the "flush all packets from the server" loop which
came after the ack. However, this loop had only a 10ms delay, and
sometimes this was not enough to catch the reply (which meant the
connection got out of sync, and test failed).
Since this behavior not consistent with how lldb-server handles this
situation (it just ignores the ack), I fix the mock server to do the
same.
llvm-svn: 323953
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py index 34843840f61..5293a32e7d1 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py @@ -200,7 +200,6 @@ class MockGDBServer: _receivedData = None _receivedDataOffset = None _shouldSendAck = True - _isExpectingAck = False def __init__(self, port = 0): self.responder = MockGDBServerResponder() @@ -237,7 +236,6 @@ class MockGDBServer: except: return self._shouldSendAck = True - self._isExpectingAck = False self._receivedData = "" self._receivedDataOffset = 0 data = None @@ -329,21 +327,15 @@ class MockGDBServer: def _handlePacket(self, packet): if packet is self.PACKET_ACK: - # If we are expecting an ack, we'll just ignore it because there's - # nothing else we're supposed to do. - # - # However, if we aren't expecting an ack, it's likely the initial - # ack that lldb client sends, and observations of real servers - # suggest we're supposed to ack back. - if not self._isExpectingAck: - self._client.sendall('+') + # Ignore ACKs from the client. For the future, we can consider + # adding validation code to make sure the client only sends ACKs + # when it's supposed to. return response = "" # We'll handle the ack stuff here since it's not something any of the # tests will be concerned about, and it'll get turned off quicly anyway. if self._shouldSendAck: self._client.sendall('+') - self._isExpectingAck = True if packet == "QStartNoAckMode": self._shouldSendAck = False response = "OK" |