(ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting
This commit is contained in:
parent
4f41f209a2
commit
dc77d62a5d
@ -1,6 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All changes to this project will be documented in this file.
|
All changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [10.0.2] - 2020-07-28
|
||||||
|
|
||||||
|
(ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting
|
||||||
|
|
||||||
## [10.0.1] - 2020-07-27
|
## [10.0.1] - 2020-07-27
|
||||||
|
|
||||||
(socket utility) move ix::getFreePort to ixwebsocket library
|
(socket utility) move ix::getFreePort to ixwebsocket library
|
||||||
|
@ -111,6 +111,12 @@ namespace ix
|
|||||||
|
|
||||||
void CobraConnection::disconnect()
|
void CobraConnection::disconnect()
|
||||||
{
|
{
|
||||||
|
auto subscriptionIds = getSubscriptionsIds();
|
||||||
|
for (auto&& subscriptionId : subscriptionIds)
|
||||||
|
{
|
||||||
|
unsubscribe(subscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
_authenticated = false;
|
_authenticated = false;
|
||||||
_webSocket->stop();
|
_webSocket->stop();
|
||||||
}
|
}
|
||||||
@ -614,6 +620,18 @@ namespace ix
|
|||||||
_webSocket->send(pdu.toStyledString());
|
_webSocket->send(pdu.toStyledString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> CobraConnection::getSubscriptionsIds()
|
||||||
|
{
|
||||||
|
std::vector<std::string> subscriptionIds;
|
||||||
|
std::lock_guard<std::mutex> lock(_cbsMutex);
|
||||||
|
|
||||||
|
for (auto&& it : _cbs)
|
||||||
|
{
|
||||||
|
subscriptionIds.push_back(it.first);
|
||||||
|
}
|
||||||
|
return subscriptionIds;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enqueue strategy drops old messages when we are at full capacity
|
// Enqueue strategy drops old messages when we are at full capacity
|
||||||
//
|
//
|
||||||
|
@ -163,6 +163,9 @@ namespace ix
|
|||||||
/// Tells whether the internal queue is empty or not
|
/// Tells whether the internal queue is empty or not
|
||||||
bool isQueueEmpty();
|
bool isQueueEmpty();
|
||||||
|
|
||||||
|
/// Retrieve all subscriptions ids
|
||||||
|
std::vector<std::string> getSubscriptionsIds();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Member variables
|
/// Member variables
|
||||||
///
|
///
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define IX_WEBSOCKET_VERSION "10.0.1"
|
#define IX_WEBSOCKET_VERSION "10.0.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user