fix to ensure numinterfaces is not called for g2

This commit is contained in:
maliakal_d 2021-07-15 17:03:29 +02:00
parent 780d4bfe0a
commit 7158dab9f5
2 changed files with 24 additions and 5 deletions

View File

@ -1739,6 +1739,7 @@ class Detector {
private:
std::vector<int> getPortNumbers(int start_port);
void updateRxRateCorrections();
void setNumberofUDPInterfaces_(int n, Positions pos);
Result<int> getNumberofUDPInterfaces_(Positions pos) const;
};
} // namespace sls

View File

@ -746,10 +746,28 @@ Result<std::string> Detector::getScanErrorMessage(Positions pos) const {
// Network Configuration (Detector<->Receiver)
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
if (getDetectorType().squash() != defs::JUNGFRAU) {
throw sls::RuntimeError(
"Cannot set number of udp interfaces for this detector.");
}
// also called by vetostream (for gotthard2)
return getNumberofUDPInterfaces_(pos);
}
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
if (getDetectorType().squash() != defs::JUNGFRAU) {
throw sls::RuntimeError(
"Cannot set number of udp interfaces for this detector.");
}
// also called by vetostream (for gotthard2)
setNumberofUDPInterfaces_(n, pos);
}
Result<int> Detector::getNumberofUDPInterfaces_(Positions pos) const {
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
}
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
bool useReceiver = getUseReceiverFlag().squash(false);
bool previouslyReceiverStreaming = false;
@ -1551,7 +1569,7 @@ Result<defs::EthernetInterface> Detector::getVetoStream(Positions pos) const {
// 3gbe
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
// 10gbe (debugging interface) opens 2nd udp interface in receiver
auto r10 = getNumberofUDPInterfaces();
auto r10 = getNumberofUDPInterfaces_(pos);
Result<defs::EthernetInterface> res(r3.size());
for (unsigned int i = 0; i < res.size(); ++i) {
@ -1570,11 +1588,11 @@ void Detector::setVetoStream(defs::EthernetInterface interface, Positions pos) {
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
// 10gbe (debugging interface) opens 2nd udp interface in receiver
int old_numinterfaces = getNumberofUDPInterfaces(pos).tsquash(
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
"retrieved inconsistent number of udp interfaces");
int numinterfaces = (interface & defs::EthernetInterface::I10GBE) ? 2 : 1;
if (numinterfaces != old_numinterfaces) {
setNumberofUDPInterfaces(numinterfaces, pos);
setNumberofUDPInterfaces_(numinterfaces, pos);
}
}