mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
host/mpm: change MPM_RPC_PORT to avoid UHD<4.10 discovery crash
UHD hosts <4.10 speak mprpc and unconditionally connect to the RPC port (49601) of any device they discover. When they reach a gRPC-based MPM device, the protocol mismatch crashes uhd_find_device. UHd host 4.10, prevents this by using rpc_version key from discovery response and skips RPC attempt if mprpc device found during uhd_find_devices. This change moves the RPC port to 49602. Now, old UHD <4.10 hosts can still discover both mprpc and grpc devices. But their mprpc connection attempt on 49601 during uhd_find_devices is refused by grpc device (running on new rpc port 49602) and is marked as not reachable instead of crashing.
This commit is contained in:
parent
ec7e94bd4b
commit
1da439c020
@ -146,7 +146,7 @@ void assert_compat_number_throw(const std::string& component,
|
||||
const std::string mpmd_impl::MPM_FINDALL_KEY = "find_all";
|
||||
const size_t mpmd_impl::MPM_DISCOVERY_PORT = 49600;
|
||||
const std::string mpmd_impl::MPM_DISCOVERY_PORT_KEY = "discovery_port";
|
||||
const size_t mpmd_impl::MPM_RPC_PORT = 49601;
|
||||
const size_t mpmd_impl::MPM_RPC_PORT = 49602;
|
||||
const std::string mpmd_impl::MPM_RPC_PORT_KEY = "rpc_port";
|
||||
const std::string mpmd_impl::MPM_DISCOVERY_CMD = "MPM-DISC";
|
||||
const std::string mpmd_impl::MPM_ECHO_CMD = "MPM-ECHO";
|
||||
|
||||
@ -10,7 +10,8 @@ import queue
|
||||
import signal
|
||||
from enum import Enum
|
||||
|
||||
MPM_RPC_PORT = 49601
|
||||
# RPC port. See usrp_mpm/mpmtypes.py.
|
||||
MPM_RPC_PORT = 49602
|
||||
MPM_DEFAULT_RPC_TIMEOUT_MS = (
|
||||
2000 # Mirrors MPMD_DEFAULT_RPC_TIMEOUT in uhdlib/usrp/common/mpmd_timeouts.hpp
|
||||
)
|
||||
|
||||
@ -10,7 +10,14 @@ MPM types
|
||||
import ctypes
|
||||
from multiprocessing import Array, RLock, Value
|
||||
|
||||
MPM_RPC_PORT = 49601
|
||||
# gRPC-based MPM (rpc_version 2) listens on a different port (49602)
|
||||
# than the legacy mprpc port (49601). Keeping the discovery message/port
|
||||
# unchanged lets old UHD hosts (<4.10) still see the device, but their
|
||||
# mprpc connection attempt on 49601 gets refused (device reported as
|
||||
# "not reachable") instead of crashing from a protocol mismatch.
|
||||
# The new hosts (>=4.10) will see the gRPC based device and connect to it
|
||||
# on 49602, using the new gRPC protocol.
|
||||
MPM_RPC_PORT = 49602
|
||||
MPM_DISCOVERY_PORT = 49600
|
||||
MPM_DISCOVERY_MESSAGE = "MPM-DISC"
|
||||
|
||||
|
||||
@ -1146,7 +1146,7 @@ class X4XXBIST(bist.UsrpBIST):
|
||||
from uhd.utils import mpmtools
|
||||
|
||||
# default MPM port
|
||||
MPM_PORT = 49601
|
||||
MPM_PORT = 49602
|
||||
|
||||
mpm_c = mpmtools.MPMClient(mpmtools.InitMode.Claim, "localhost", MPM_PORT)
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ def _camel_to_snake(name):
|
||||
return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s1).lower()
|
||||
|
||||
|
||||
DEFAULT_MPM_RPC_PORT = 49601
|
||||
DEFAULT_MPM_RPC_PORT = 49602
|
||||
if MPM_RPC_PORT is None:
|
||||
MPM_RPC_PORT = DEFAULT_MPM_RPC_PORT
|
||||
if MPM_RPC_PORT != DEFAULT_MPM_RPC_PORT:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user