mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
rx_arping for 10g mode (#359)
* test for rx_arping * arping ip and interface from client interface * apring thread added to thread ids * clean code for thread for arping * removing the assumption that udpip1 fill be updated along with udpip2 * review, replacing syscall(sys_gettid) with gettid()
This commit is contained in:
@ -878,10 +878,18 @@ class Detector {
|
||||
Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const;
|
||||
|
||||
/** Get thread ids from the receiver in order of [parent, tcp, listener 0,
|
||||
* processor 0, streamer 0, listener 1, processor 1, streamer 1]. If no
|
||||
* streamer yet or there is no second interface, it gives 0 in its place. */
|
||||
* processor 0, streamer 0, listener 1, processor 1, streamer 1, arping]. If
|
||||
* no streamer yet or there is no second interface, it gives 0 in its place.
|
||||
*/
|
||||
Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
|
||||
getRxThreadIds(Positions pos = {}) const;
|
||||
|
||||
Result<bool> getRxArping(Positions pos = {}) const;
|
||||
|
||||
/** Starts a thread in slsReceiver to arping the interface it is listening
|
||||
* every minute. Useful in 10G mode. */
|
||||
void setRxArping(bool value, Positions pos = {});
|
||||
|
||||
///@}
|
||||
|
||||
/** @name File */
|
||||
|
@ -903,6 +903,7 @@ class CmdProxy {
|
||||
{"rx_lock", &CmdProxy::rx_lock},
|
||||
{"rx_lastclient", &CmdProxy::rx_lastclient},
|
||||
{"rx_threads", &CmdProxy::rx_threads},
|
||||
{"rx_arping", &CmdProxy::rx_arping},
|
||||
|
||||
/* File */
|
||||
{"fformat", &CmdProxy::fformat},
|
||||
@ -1738,13 +1739,16 @@ class CmdProxy {
|
||||
rx_lastclient, getRxLastClientIP,
|
||||
"\n\tClient IP Address that last communicated with the receiver.");
|
||||
|
||||
GET_COMMAND(
|
||||
rx_threads, getRxThreadIds,
|
||||
"\n\tGet thread ids from the receiver in order of [parent, tcp, "
|
||||
"listener 0, "
|
||||
"processor 0, streamer 0, listener 1, processor 1, streamer 1]. If no "
|
||||
"streamer yet or there is no second interface, it gives 0 in its "
|
||||
"place.");
|
||||
GET_COMMAND(rx_threads, getRxThreadIds,
|
||||
"\n\tGet thread ids from the receiver in order of [parent, "
|
||||
"tcp, listener 0, processor 0, streamer 0, listener 1, "
|
||||
"processor 1, streamer 1, arping]. If no streamer yet or there "
|
||||
"is no second interface, it gives 0 in its place.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(rx_arping, getRxArping, setRxArping, StringTo<int>,
|
||||
"[0, 1]\n\tStarts a thread in slsReceiver to arping "
|
||||
"the interface it is "
|
||||
"listening to every minute. Useful in 10G mode.");
|
||||
|
||||
/* File */
|
||||
|
||||
|
@ -1170,6 +1170,14 @@ Detector::getRxThreadIds(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getReceiverThreadIds, pos);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getRxArping(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getRxArping, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxArping(bool value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setRxArping, pos, value);
|
||||
}
|
||||
|
||||
// File
|
||||
|
||||
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
||||
|
@ -1318,6 +1318,14 @@ std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
||||
F_GET_RECEIVER_THREAD_IDS);
|
||||
}
|
||||
|
||||
bool Module::getRxArping() const {
|
||||
return sendToReceiver<int>(F_GET_RECEIVER_ARPING);
|
||||
}
|
||||
|
||||
void Module::setRxArping(bool enable) {
|
||||
sendToReceiver(F_SET_RECEIVER_ARPING, static_cast<int>(enable), nullptr);
|
||||
}
|
||||
|
||||
// File
|
||||
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
||||
|
@ -283,6 +283,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setReceiverLock(bool lock);
|
||||
sls::IpAddr getReceiverLastClientIP() const;
|
||||
std::array<pid_t, NUM_RX_THREAD_IDS> getReceiverThreadIds() const;
|
||||
bool getRxArping() const;
|
||||
void setRxArping(bool enable);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
|
@ -385,6 +385,30 @@ TEST_CASE("rx_threads", "[.cmd][.rx]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("rx_threads", {}, -1, GET, oss));
|
||||
}
|
||||
|
||||
TEST_CASE("rx_arping", "[.cmd][.rx]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getRxArping();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_arping", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_arping 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_arping", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_arping 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_arping", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_arping 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRxArping(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
|
||||
/* File */
|
||||
|
||||
TEST_CASE("fformat", "[.cmd]") {
|
||||
|
Reference in New Issue
Block a user