Skip to content

Commit

Permalink
Fix IP decoding from SpiNNaker machine.
Browse files Browse the repository at this point in the history
  • Loading branch information
mossblaser committed Mar 23, 2015
1 parent 2d03c9f commit b666e80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rig/machine_control/machine_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion rig/machine_control/tests/test_machine_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b666e80

Please sign in to comment.