Inverted some ifs to get the semantic of ifs more clear
This commit is contained in:
@@ -53,22 +53,20 @@ class Qos2Publisher {
|
||||
LOG.debug("Broker republishing to client <{}> topic <{}> qos <{}>, active {}",
|
||||
sub.getClientId(), sub.getTopicFilter(), qos, targetIsActive);
|
||||
ByteBuffer message = origMessage.duplicate();
|
||||
if (qos == AbstractMessage.QOSType.MOST_ONE && targetIsActive) {
|
||||
if (targetIsActive) {
|
||||
//QoS 0
|
||||
publishQos2(targetSession, topic, qos, message, false, null);
|
||||
if (qos == AbstractMessage.QOSType.MOST_ONE) {
|
||||
publishQos2(targetSession, topic, qos, message, false, null);
|
||||
} else {
|
||||
//QoS 1 or 2
|
||||
int messageId = targetSession.nextPacketId();
|
||||
targetSession.inFlightAckWaiting(guid, messageId);
|
||||
publishQos2(targetSession, topic, qos, message, false, messageId);
|
||||
}
|
||||
} else {
|
||||
//QoS 1 or 2
|
||||
//if the target subscription is not clean session and is not connected => store it
|
||||
if (!targetSession.isCleanSession() && !targetIsActive) {
|
||||
if (!targetSession.isCleanSession()) {
|
||||
//store the message in targetSession queue to deliver
|
||||
targetSession.enqueueToDeliver(guid);
|
||||
} else {
|
||||
//publish
|
||||
if (targetIsActive) {
|
||||
int messageId = targetSession.nextPacketId();
|
||||
targetSession.inFlightAckWaiting(guid, messageId);
|
||||
publishQos2(targetSession, topic, qos, message, false, messageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user