mirror of
https://github.com/apache/activemq.git
synced 2025-02-16 23:16:52 +00:00
Fix duplicate call to unsubscribe.
This commit is contained in:
parent
2cd54248c6
commit
efa55278ec
@ -154,7 +154,8 @@ public class MQTTProtocolConverter {
|
|||||||
if (command instanceof ActiveMQMessage) {
|
if (command instanceof ActiveMQMessage) {
|
||||||
ActiveMQMessage msg = (ActiveMQMessage) command;
|
ActiveMQMessage msg = (ActiveMQMessage) command;
|
||||||
if (!getPublishDollarTopics() && msg.getDestination().getPhysicalName().startsWith("$")) {
|
if (!getPublishDollarTopics() && msg.getDestination().getPhysicalName().startsWith("$")) {
|
||||||
// We don't allow users to send to $ prefixed topics to avoid failing MQTT 3.1.1 spec requirements
|
// We don't allow users to send to $ prefixed topics to avoid failing MQTT 3.1.1
|
||||||
|
// specification requirements
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
try {
|
try {
|
||||||
handler.onResponse(this, new Response());
|
handler.onResponse(this, new Response());
|
||||||
@ -186,7 +187,6 @@ public class MQTTProtocolConverter {
|
|||||||
* Convert a MQTT command
|
* Convert a MQTT command
|
||||||
*/
|
*/
|
||||||
public void onMQTTCommand(MQTTFrame frame) throws IOException, JMSException {
|
public void onMQTTCommand(MQTTFrame frame) throws IOException, JMSException {
|
||||||
|
|
||||||
switch (frame.messageType()) {
|
switch (frame.messageType()) {
|
||||||
case PINGREQ.TYPE: {
|
case PINGREQ.TYPE: {
|
||||||
LOG.debug("Received a ping from client: " + getClientId());
|
LOG.debug("Received a ping from client: " + getClientId());
|
||||||
@ -240,7 +240,6 @@ public class MQTTProtocolConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onMQTTConnect(final CONNECT connect) throws MQTTProtocolException {
|
void onMQTTConnect(final CONNECT connect) throws MQTTProtocolException {
|
||||||
|
|
||||||
if (connected.get()) {
|
if (connected.get()) {
|
||||||
throw new MQTTProtocolException("Already connected.");
|
throw new MQTTProtocolException("Already connected.");
|
||||||
}
|
}
|
||||||
@ -423,12 +422,10 @@ public class MQTTProtocolConverter {
|
|||||||
// remove old subscription as the QoS has changed
|
// remove old subscription as the QoS has changed
|
||||||
onUnSubscribe(topicName);
|
onUnSubscribe(topicName);
|
||||||
} else {
|
} else {
|
||||||
// duplicate SUBSCRIBE packet, find all matching topics and resend retained messages
|
// duplicate SUBSCRIBE packet, find all matching topics and re-send retained messages
|
||||||
resendRetainedMessages(topicName, destination, mqttSubscription);
|
resendRetainedMessages(topicName, destination, mqttSubscription);
|
||||||
|
|
||||||
return (byte) topicQoS.ordinal();
|
return (byte) topicQoS.ordinal();
|
||||||
}
|
}
|
||||||
onUnSubscribe(topicName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsumerId id = new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId());
|
ConsumerId id = new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId());
|
||||||
@ -914,7 +911,6 @@ public class MQTTProtocolConverter {
|
|||||||
char[] chars = name.toCharArray();
|
char[] chars = name.toCharArray();
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (int i = 0; i < chars.length; i++) {
|
||||||
switch(chars[i]) {
|
switch(chars[i]) {
|
||||||
|
|
||||||
case '#':
|
case '#':
|
||||||
chars[i] = '>';
|
chars[i] = '>';
|
||||||
break;
|
break;
|
||||||
@ -928,14 +924,12 @@ public class MQTTProtocolConverter {
|
|||||||
case '*':
|
case '*':
|
||||||
chars[i] = '+';
|
chars[i] = '+';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
chars[i] = '.';
|
chars[i] = '.';
|
||||||
break;
|
break;
|
||||||
case '.':
|
case '.':
|
||||||
chars[i] = '/';
|
chars[i] = '/';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String rc = new String(chars);
|
String rc = new String(chars);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user