diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-12-14 14:53:45 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:58 -0800 |
commit | 0c94fff3300d2c1c1c98367d99e1457f073a1892 (patch) | |
tree | 4cdea43c57f48ec9ce9905827772477c479731e4 | |
parent | 20160e806199474c8481215236696f16f573ce8a (diff) | |
download | uhd-0c94fff3300d2c1c1c98367d99e1457f073a1892.tar.gz uhd-0c94fff3300d2c1c1c98367d99e1457f073a1892.tar.bz2 uhd-0c94fff3300d2c1c1c98367d99e1457f073a1892.zip |
mpm: rpc_server: Unregister old RPC calls _init_rpc_calls()
On FPGA loads, when the periph_manager is respawned, this will now
clear the previously registered methods.
Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
-rw-r--r-- | mpm/python/usrp_mpm/rpc_server.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py index 51ba9272b..c3b4fc2dd 100644 --- a/mpm/python/usrp_mpm/rpc_server.py +++ b/mpm/python/usrp_mpm/rpc_server.py @@ -68,12 +68,32 @@ class MPMServer(RPCServer): def _init_rpc_calls(self, mgr): """ - Register all RPC calls for the motherboard and daughterboards - """ + Register all RPC calls for the motherboard and daughterboards. + + First clears out all previously registered RPC calls. + """ + # Clear old calls: + for meth_list in (self._db_methods, self._mb_methods): + for method in meth_list: + if hasattr(self, method): + delattr(self, method) + else: + self.log.warning( + "Attempted to remove non-existant method: %s", + method + ) + self._db_methods = [] + self._mb_methods = [] + # Register new ones: self._update_component_commands(mgr, '', '_mb_methods') for db_slot, dboard in enumerate(mgr.dboards): cmd_prefix = 'db_' + str(db_slot) + '_' self._update_component_commands(dboard, cmd_prefix, '_db_methods') + self.log.debug( + "Registered %d motherboard methods, %d daughterboard methods.", + len(self._mb_methods), + len(self._db_methods), + ) def _check_token_valid(self, token): """ |