Fix issue #30 rewind of message ByteBuffer
This commit is contained in:
+5
-3
@@ -245,15 +245,15 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
||||
* */
|
||||
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer message, boolean retain, Integer messageID) {
|
||||
LOG.debug("publish2Subscribers republishing to existing subscribers that matches the topic {}, content", topic);
|
||||
LOG.debug("content <{}>", new String(message.array()));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("content <{}>", DebugUtils.payload2Str(message));
|
||||
LOG.debug("subscription tree {}", subscriptions.dumpTree());
|
||||
}
|
||||
for (final Subscription sub : subscriptions.matches(topic)) {
|
||||
if (qos.ordinal() > sub.getRequestedQos().ordinal()) {
|
||||
qos = sub.getRequestedQos();
|
||||
}
|
||||
|
||||
message.rewind();
|
||||
LOG.debug("Broker republishing to client <{}> topic <{}> qos <{}>, active {}",
|
||||
sub.getClientId(), sub.getTopic(), qos, sub.isActive());
|
||||
|
||||
@@ -298,7 +298,9 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
||||
pubMessage.setPayload(message);
|
||||
|
||||
LOG.info("send publish message to <{}> on topic <{}>", clientId, topic);
|
||||
LOG.debug("content <{}>", new String(message.array()));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("content <{}>", DebugUtils.payload2Str(message));
|
||||
}
|
||||
if (pubMessage.getQos() != AbstractMessage.QOSType.MOST_ONE) {
|
||||
pubMessage.setMessageID(messageID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user