Commit 6dec7770 authored by Micha Müller's avatar Micha Müller
Browse files

Pusher: fixes to Caliper plugin

parent fd7dbb41
global {
mqttPrefix /FF112233445566778899AABB
mqttPrefix /caliper
}
group cali {
......
......@@ -1066,7 +1066,7 @@ protected:
*/
bool constructSensorTopics() {
// Sensor names are adjusted according to the respective MQTT topics
for(auto& g: _sensorGroups)
for(auto& g: _sensorGroups) {
for(auto& s: g->acquireSensors()) {
s->setMqtt(MQTTChecker::formatTopic(_mqttPrefix) +
MQTTChecker::formatTopic(g->getMqttPart()) +
......@@ -1075,6 +1075,8 @@ protected:
if(s->getSinkPath()!="")
s->setSinkPath(MQTTChecker::topicToFile(s->getMqtt(), s->getSinkPath()));
}
g->releaseSensors();
}
return true;
}
///@}
......
......@@ -132,13 +132,9 @@ void CaliperSensorGroup::read() {
//retrieve all messages currently available at the socket
while(true) {
const ssize_t nrec = recv(_connection, (void *) buf, bufSize, MSG_DONTWAIT);
#ifdef DEBUG
LOG(debug) << _groupName << ": Receiving message...";
#endif
//nrec==0 indicates that the connection was closed. Probably because Caliper terminated
if (nrec == 0) {
//TODO clean up sensors
close(_connection);
_connection = -1;
LOG(debug) << _groupName << ": Connection closed";
......@@ -164,9 +160,6 @@ void CaliperSensorGroup::read() {
reading_t reading;
reading.value = 1;
reading.timestamp = std::stoull(timestamp);
#ifdef DEBUG
LOG(debug) << _groupName << ": Received value " << feName << " (" << timestamp << ")";
#endif
S_Ptr s;
auto it = _sensorIndex.find(feName);
......
......@@ -49,7 +49,6 @@ public:
bool execOnStart() final override;
void execOnStop() final override;
//TODO spins forever ?! why !?!? probably some evil spirit does not release sensors after acquiring them
std::vector<SBasePtr>& acquireSensors() final override {
while (_lock.test_and_set(std::memory_order_acquire)) {}
return _baseSensors;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment