From b666e802f97a7321c3c8a1192495744949e0c5b5 Mon Sep 17 00:00:00 2001 From: Jonathan Heathcote Date: Mon, 23 Mar 2015 11:30:38 +0000 Subject: [PATCH] Fix IP decoding from SpiNNaker machine. --- rig/machine_control/machine_controller.py | 3 ++- rig/machine_control/tests/test_machine_controller.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rig/machine_control/machine_controller.py b/rig/machine_control/machine_controller.py index c768011..429f597 100644 --- a/rig/machine_control/machine_controller.py +++ b/rig/machine_control/machine_controller.py @@ -194,6 +194,7 @@ def connect_to_hosts(self, hosts): connection_requests = [ self.loop.create_datagram_endpoint( lambda: SCPProtocol(loop=self.loop, + max_outstanding=1, n_tries=self.n_tries, timeout=self.timeout), remote_addr=(remote_addr, self.scp_port), @@ -284,7 +285,7 @@ def discover_connections(self): if eth_up: # Convert IP addresses into string format hosts[(x, y)] = ".".join(str((ip_addr >> (i * 8)) & 0xFF) - for i in reversed(range(4))) + for i in range(4)) # Strip out connections which are already present for coord in self.connections: diff --git a/rig/machine_control/tests/test_machine_controller.py b/rig/machine_control/tests/test_machine_controller.py index 5cf80d8..bbb3a52 100644 --- a/rig/machine_control/tests/test_machine_controller.py +++ b/rig/machine_control/tests/test_machine_controller.py @@ -1588,7 +1588,7 @@ def read_struct_field(struct_name, field_name, x, y): if field_name == "eth_up": return int((x, y) != (8, 4)) # (8, 4) is not connected elif field_name == "ip_addr": - return 192 << 24 | 168 << 16 | x << 8 | y << 0 + return 192 << 0 | 168 << 8 | x << 16 | y << 24 else: # pragma: no cover assert False, "Unexpected field '{}' read.".format(field_name) cn.read_struct_field = future_side_effect(read_struct_field)