Squashed 'libs/CommService/' changes from 7ccc0fc..e3612a5
e3612a5 FIX: fixed the termination of the processes git-subtree-dir: libs/CommService git-subtree-split: e3612a55032895575a2f3394511d6c09b2a98988
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
#ifndef __PAYLOADS_JOIN__
|
||||
#define __PAYLOADS_JOIN__
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief main header file for the BC::Payloads::HotPlugJoin payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-03
|
||||
* @copyright 2019 no yet defined
|
||||
* @brief main header file for the Join payload
|
||||
* @author Henry Winkel
|
||||
* @date 15.09.2022
|
||||
* @copyright
|
||||
*/
|
||||
#include <CommService/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
#ifndef __PAYLOADS_LEAVE__
|
||||
#define __PAYLOADS_LEAVE__
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief main header file for the Leave payload
|
||||
* @author Henry Winkel
|
||||
* @date 15.09.2022
|
||||
* @copyright
|
||||
*/
|
||||
#include <CommService/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
#ifndef __PAYLOADS_PING__
|
||||
#define __PAYLOADS_PING__
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief main header file for the BC::Payloads::Ping payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-06
|
||||
* @copyright 2019 no yet defined
|
||||
* @brief main header file for the BPing payload
|
||||
* @author Henry Winkel
|
||||
* @date 15.09.2022
|
||||
* @copyright
|
||||
*/
|
||||
#include <CommService/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
#ifndef __LIBBC_BC_PAYLOADS_PONG_HPP__
|
||||
#define __LIBBC_BC_PAYLOADS_PONG_HPP__
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief main header file for the BC::Payloads::Pong payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-06
|
||||
* @copyright 2019 no yet defined
|
||||
* @brief main header file for the Pong payload
|
||||
* @author Henry Winkel
|
||||
* @date 15.09.2022
|
||||
* @copyright
|
||||
*/
|
||||
#include <CommService/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -94,27 +94,29 @@ namespace CommService {
|
||||
}
|
||||
|
||||
|
||||
receiveThread = std::thread(&CommService::receiveThreadFunc,this);
|
||||
receiveThread = std::thread(&CommService::receiveThreadFunc,this);
|
||||
|
||||
Message m;
|
||||
m.topic = messageTopic::JOIN;
|
||||
m.sourceID = deviceID_;
|
||||
Message m;
|
||||
m.topic = messageTopic::JOIN;
|
||||
m.sourceID = deviceID_;
|
||||
|
||||
|
||||
// wait until service is really connected
|
||||
while(!connected)
|
||||
{
|
||||
// wait until service is really connected
|
||||
while(!connected)
|
||||
{
|
||||
|
||||
}
|
||||
LOG_S(INFO)<< "connected";
|
||||
}
|
||||
LOG_S(INFO)<< "connected";
|
||||
|
||||
// publish the hotplug join message
|
||||
publish(m);
|
||||
// publish the hotplug join message
|
||||
publish(m);
|
||||
|
||||
}
|
||||
|
||||
void CommService::disconnect(){
|
||||
close(inetSocket);
|
||||
LOG_S(INFO)<< "socket closed";
|
||||
receiveThread.join();
|
||||
connected = false;
|
||||
}
|
||||
|
||||
@@ -376,14 +378,11 @@ namespace CommService {
|
||||
void CommService::stop(){
|
||||
stopReceiveThread = true;
|
||||
|
||||
while (receiving == false) {
|
||||
|
||||
}
|
||||
LOG_S(INFO)<<"receive thread stoped";
|
||||
LOG_S(INFO)<<"receive thread stoped ";
|
||||
|
||||
Message m;
|
||||
m.topic = messageTopic::LEAVE;
|
||||
LOG_S(INFO) << "own device = "<<deviceID_;
|
||||
m.sourceID = deviceID_;
|
||||
publish(m);
|
||||
|
||||
@@ -397,9 +396,6 @@ namespace CommService {
|
||||
}
|
||||
|
||||
CommService::~CommService(){
|
||||
if (connected == true) {
|
||||
disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user