Skip to content

Commit 2adda68

Browse files
authored
Merge pull request #1915 from OpenC3/catch_hostname_lookup_errors
Add exception catch on python hostname lookup
2 parents 482621e + 3ba61a1 commit 2adda68

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

openc3/python/openc3/interfaces/tcpip_server_interface.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,11 @@ def _listen_thread_body(self, listen_socket, listen_write, listen_read, thread_r
374374
if self.cancel_threads:
375375
break
376376
host_ip, port = address
377-
hostname, _, _ = socket.gethostbyaddr(host_ip)
377+
try:
378+
hostname, _, _ = socket.gethostbyaddr(host_ip)
379+
except Exception:
380+
hostname = "UNKNOWN"
381+
378382
# Configure TCP_NODELAY option
379383
client_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
380384

0 commit comments

Comments
 (0)