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

Pusher: fixes to Caliper plugin

parent fd7dbb41
global { global {
mqttPrefix /FF112233445566778899AABB mqttPrefix /caliper
} }
group cali { group cali {
......
...@@ -1066,7 +1066,7 @@ protected: ...@@ -1066,7 +1066,7 @@ protected:
*/ */
bool constructSensorTopics() { bool constructSensorTopics() {
// Sensor names are adjusted according to the respective MQTT topics // Sensor names are adjusted according to the respective MQTT topics
for(auto& g: _sensorGroups) for(auto& g: _sensorGroups) {
for(auto& s: g->acquireSensors()) { for(auto& s: g->acquireSensors()) {
s->setMqtt(MQTTChecker::formatTopic(_mqttPrefix) + s->setMqtt(MQTTChecker::formatTopic(_mqttPrefix) +
MQTTChecker::formatTopic(g->getMqttPart()) + MQTTChecker::formatTopic(g->getMqttPart()) +
...@@ -1075,6 +1075,8 @@ protected: ...@@ -1075,6 +1075,8 @@ protected:
if(s->getSinkPath()!="") if(s->getSinkPath()!="")
s->setSinkPath(MQTTChecker::topicToFile(s->getMqtt(), s->getSinkPath())); s->setSinkPath(MQTTChecker::topicToFile(s->getMqtt(), s->getSinkPath()));
} }
g->releaseSensors();
}
return true; return true;
} }
///@} ///@}
......
...@@ -132,13 +132,9 @@ void CaliperSensorGroup::read() { ...@@ -132,13 +132,9 @@ void CaliperSensorGroup::read() {
//retrieve all messages currently available at the socket //retrieve all messages currently available at the socket
while(true) { while(true) {
const ssize_t nrec = recv(_connection, (void *) buf, bufSize, MSG_DONTWAIT); 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 //nrec==0 indicates that the connection was closed. Probably because Caliper terminated
if (nrec == 0) { if (nrec == 0) {
//TODO clean up sensors
close(_connection); close(_connection);
_connection = -1; _connection = -1;
LOG(debug) << _groupName << ": Connection closed"; LOG(debug) << _groupName << ": Connection closed";
...@@ -164,9 +160,6 @@ void CaliperSensorGroup::read() { ...@@ -164,9 +160,6 @@ void CaliperSensorGroup::read() {
reading_t reading; reading_t reading;
reading.value = 1; reading.value = 1;
reading.timestamp = std::stoull(timestamp); reading.timestamp = std::stoull(timestamp);
#ifdef DEBUG
LOG(debug) << _groupName << ": Received value " << feName << " (" << timestamp << ")";
#endif
S_Ptr s; S_Ptr s;
auto it = _sensorIndex.find(feName); auto it = _sensorIndex.find(feName);
......
...@@ -49,7 +49,6 @@ public: ...@@ -49,7 +49,6 @@ public:
bool execOnStart() final override; bool execOnStart() final override;
void execOnStop() 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 { std::vector<SBasePtr>& acquireSensors() final override {
while (_lock.test_and_set(std::memory_order_acquire)) {} while (_lock.test_and_set(std::memory_order_acquire)) {}
return _baseSensors; 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