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
This commit is contained in:
parent
17c4633e7f
commit
71ad71e530
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue