FIX:fixed issue of unsubscribing while stopping the service
This commit is contained in:
@@ -91,13 +91,13 @@ namespace WHISPER {
|
||||
{
|
||||
WHISPER::Leave Leave(getParentID(),getOwnID(),getOwnDeviceType(),ownReceivingPort_,myAdress_);
|
||||
this->publish(Leave.serialize(),WHISPER::MsgTopicsMap[(WHISPER::MsgTopics)Leave.topic_]);
|
||||
unsubscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
// unsubscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
|
||||
if (subscribedTopics.size() > 0) {
|
||||
for ( std::vector<std::string>::iterator it = subscribedTopics.begin(); it != subscribedTopics.end(); it++) {
|
||||
unsubscribe(*it);
|
||||
}
|
||||
}
|
||||
// if (subscribedTopics.size() > 0) {
|
||||
// for ( std::vector<std::string>::iterator it = subscribedTopics.begin(); it != subscribedTopics.end(); it++) {
|
||||
// unsubscribe(*it);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ namespace WHISPER
|
||||
|
||||
void whispercomm::disconnect()
|
||||
{
|
||||
if (subscribedTopics.size() > 0) {
|
||||
for ( std::vector<std::string>::iterator it = subscribedTopics.begin(); it != subscribedTopics.end(); it++) {
|
||||
unsubscribe(*it);
|
||||
}
|
||||
}
|
||||
|
||||
stopReceiveThread = true;
|
||||
if(receiveThread.joinable()) receiveThread.join();
|
||||
derivedDisconnect();
|
||||
|
||||
Reference in New Issue
Block a user