File tree Expand file tree Collapse file tree
src/software/thunderscope Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ py_library(
2323 "//proto:import_all_protos" ,
2424 "//software/networking:ssl_proto_communication" ,
2525 "//software/thunderscope/common:thread_safe_circular_buffer" ,
26+ "//software/thunderscope:util" ,
2627 ],
2728)
2829
Original file line number Diff line number Diff line change 44import random
55import logging
66import os
7- import socket
87import time
98from subprocess import Popen
109from typing import Any
2120from software .thunderscope .common .thread_safe_circular_buffer import (
2221 ThreadSafeCircularBuffer ,
2322)
23+ from software .thunderscope .util import is_current_platform_macos
2424
2525logger = logging .getLogger (__name__ )
2626import itertools
@@ -288,10 +288,16 @@ def __send_referee_command(data: Referee) -> None:
288288 if autoref_proto_unix_io is not None :
289289 autoref_proto_unix_io .send_proto (Referee , data )
290290
291+
292+ if is_current_platform_macos ():
293+ loopback_iface = "en0"
294+ else :
295+ loopback_iface = "lo"
296+
291297 self .receive_referee_command = tbots_cpp .SSLRefereeProtoListener (
292298 Gamecontroller .REFEREE_IP ,
293299 self .referee_port ,
294- "lo" ,
300+ loopback_iface ,
295301 __send_referee_command ,
296302 True ,
297303 )
Original file line number Diff line number Diff line change 1+ import platform
12from typing import Callable , NoReturn , TYPE_CHECKING
23
34if TYPE_CHECKING :
@@ -195,3 +196,10 @@ def color_from_gradient(
195196 int (b_range [i ] + (b_range [i + 1 ] - b_range [i ]) * sig_val ),
196197 int (a_range [i ] + (a_range [i + 1 ] - a_range [i ]) * sig_val ),
197198 )
199+
200+ def is_current_platform_macos () -> bool :
201+ """
202+ Return True if the current process is running on macOS.
203+ Uses platform.system(), which should reliably return 'Darwin' on macOS.
204+ """
205+ return platform .system ().lower () == "darwin"
You can’t perform that action at this time.
0 commit comments