Don't schedule a NOP for TCP frame padding; instead just have the ACK

include the 2 dummy reads.
This commit is contained in:
kris 2019-03-15 21:09:45 +00:00
parent 7343aa39ed
commit fffd05f4d1
2 changed files with 6 additions and 6 deletions

View File

@ -57,12 +57,7 @@ class Movie:
# Keep track of where we are in TCP client socket buffer # Keep track of where we are in TCP client socket buffer
socket_pos = self.stream_pos % 2048 socket_pos = self.stream_pos % 2048
if socket_pos >= 2044: if socket_pos >= 2044:
# Pad out to last byte in frame # 2 dummy bytes + 2 address bytes for next opcode
nops = (2047 - socket_pos) // 2
# print("At position %04x, padding with %d nops" % (
# socket_pos, nops))
for _ in range(nops):
yield from self._emit_bytes(opcodes.Nop())
yield from self._emit_bytes(opcodes.Ack()) yield from self._emit_bytes(opcodes.Ack())
yield from self._emit_bytes(op) yield from self._emit_bytes(op)

View File

@ -115,6 +115,11 @@ class Ack(Opcode):
COMMAND = OpcodeCommand.ACK COMMAND = OpcodeCommand.ACK
_CYCLES = 100 # TODO: count _CYCLES = 100 # TODO: count
def emit_data(self) -> Iterator[int]:
# Dummy bytes to pad out TCP frame
yield 0xff
yield 0xff
def __data_eq__(self, other): def __data_eq__(self, other):
return True return True