Skip to content

Commit b6d70b9

Browse files
committed
netdev_query module is optional
1 parent c25c2dd commit b6d70b9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

xpra/net/bytestreams.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,18 @@ def do_get_socket_info(self, s) -> dict[str, Any]:
501501
opts["IP"] = get_socket_options(s, socket.SOL_IP, IP_OPTIONS)
502502
if self.socktype_wrapped in TCP_SOCKTYPES:
503503
opts["TCP"] = get_socket_options(s, socket.IPPROTO_TCP, TCP_OPTIONS)
504-
from xpra.platform.netdev_query import get_tcp_info
505504
try:
506-
opts["TCP_INFO"] = get_tcp_info(s)
507-
except (OSError, ValueError) as e:
508-
log(f"get_tcp_info({s})", exc_info=True)
509-
if self.is_active() and not self.error_is_closed(e):
510-
log.warn("Warning: failed to get tcp information")
511-
log.warn(f" from {self.socktype} socket {self}")
505+
from xpra.platform.netdev_query import get_tcp_info
506+
except ImportError as e:
507+
log("do_get_socket_info() no netdev_query: %s", e)
508+
else:
509+
try:
510+
opts["TCP_INFO"] = get_tcp_info(s)
511+
except (OSError, ValueError) as e:
512+
log(f"get_tcp_info({s})", exc_info=True)
513+
if self.is_active() and not self.error_is_closed(e):
514+
log.warn("Warning: failed to get tcp information")
515+
log.warn(f" from {self.socktype} socket {self}")
512516
# ipv6: IPV6_ADDR_PREFERENCES, IPV6_CHECKSUM, IPV6_DONTFRAG, IPV6_DSTOPTS, IPV6_HOPOPTS,
513517
# IPV6_MULTICAST_HOPS, IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP, IPV6_NEXTHOP, IPV6_PATHMTU,
514518
# IPV6_PKTINFO, IPV6_PREFER_TEMPADDR, IPV6_RECVDSTOPTS, IPV6_RECVHOPLIMIT, IPV6_RECVHOPOPTS,

0 commit comments

Comments
 (0)