mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
ips/switch: add more sanity checks for making connections
This commit is contained in:
parent
e9add5d602
commit
00fb0363dd
1 changed files with 18 additions and 1 deletions
|
@ -73,9 +73,26 @@ bool
|
|||
AxiStreamSwitch::connectInternal(const std::string& portSlave,
|
||||
const std::string& portMaster)
|
||||
{
|
||||
// check if slave port exists
|
||||
try {
|
||||
getSlavePort(portSlave);
|
||||
} catch(const std::out_of_range&) {
|
||||
logger->error("Switch doesn't have a slave port named '{}'", portSlave);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if master port exists
|
||||
try {
|
||||
getMasterPort(portMaster);
|
||||
} catch(const std::out_of_range&) {
|
||||
logger->error("Switch doesn't have a master port named '{}'", portMaster);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(portSlave.substr(0, 1) != "S" or
|
||||
portMaster.substr(0, 1) != "M") {
|
||||
logger->error("sanity check failed");
|
||||
logger->error("sanity check failed: master {} slave {}",
|
||||
portMaster, portSlave);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue