Fixed issue #49, duplication of subscription with different QoS
This commit is contained in:
@@ -30,8 +30,8 @@ class TreeNode {
|
||||
|
||||
TreeNode m_parent;
|
||||
Token m_token;
|
||||
List<TreeNode> m_children = new ArrayList<TreeNode>();
|
||||
List<Subscription> m_subscriptions = new ArrayList<Subscription>();
|
||||
List<TreeNode> m_children = new ArrayList<>();
|
||||
List<Subscription> m_subscriptions = new ArrayList<>();
|
||||
|
||||
TreeNode(TreeNode parent) {
|
||||
this.m_parent = parent;
|
||||
@@ -51,7 +51,9 @@ class TreeNode {
|
||||
return;
|
||||
}
|
||||
//remove existing subscription for same client and topic but different QoS
|
||||
int existingSubIdx = Collections.binarySearch(m_subscriptions, s, new ClientIDComparator());
|
||||
Comparator<Subscription> comparator = new ClientIDComparator();
|
||||
Collections.sort(m_subscriptions, comparator);
|
||||
int existingSubIdx = Collections.binarySearch(m_subscriptions, s, comparator);
|
||||
if (existingSubIdx >= 0) {
|
||||
m_subscriptions.remove(existingSubIdx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user