Minor fixes to typos

This commit is contained in:
selva.andre
2013-09-19 20:11:52 +02:00
parent 1dfc6ff77c
commit f09fcd6cd5
4 changed files with 190 additions and 185 deletions
@@ -57,9 +57,11 @@ class ProtocolProcessor {
} }
void processConnect(ServerChannel session, ConnectMessage msg) { void processConnect(ServerChannel session, ConnectMessage msg) {
LOG.info("processConnect for client " + msg.getClientID());
if (msg.getProcotolVersion() != 0x03) { if (msg.getProcotolVersion() != 0x03) {
ConnAckMessage badProto = new ConnAckMessage(); ConnAckMessage badProto = new ConnAckMessage();
badProto.setReturnCode(ConnAckMessage.UNNACEPTABLE_PROTOCOL_VERSION); badProto.setReturnCode(ConnAckMessage.UNNACEPTABLE_PROTOCOL_VERSION);
LOG.info("processConnect sent bad proto ConnAck");
session.write(badProto); session.write(badProto);
session.close(false); session.close(false);
return; return;
@@ -130,6 +132,7 @@ class ProtocolProcessor {
ConnAckMessage okResp = new ConnAckMessage(); ConnAckMessage okResp = new ConnAckMessage();
okResp.setReturnCode(ConnAckMessage.CONNECTION_ACCEPTED); okResp.setReturnCode(ConnAckMessage.CONNECTION_ACCEPTED);
LOG.info("processConnect sent OK ConnAck");
session.write(okResp); session.write(okResp);
if (!msg.isCleanSession()) { if (!msg.isCleanSession()) {
@@ -187,7 +190,7 @@ class ProtocolProcessor {
} }
m_storageService.cleanInFlight(publishKey); m_storageService.cleanInFlight(publishKey);
sendPubAck(new PubAckEvent(evt.getMessageID(), evt.getClientID())); sendPubAck(new PubAckEvent(evt.getMessageID(), evt.getClientID()));
LOG.info("replying with PubAck to MSG ID " + evt.getMessageID()); LOG.debug("replying with PubAck to MSG ID " + evt.getMessageID());
} }
if (retain) { if (retain) {
@@ -199,7 +202,9 @@ class ProtocolProcessor {
* Flood the subscribers with the message to notify. MessageID is optional and should only used for QoS 1 and 2 * Flood the subscribers with the message to notify. MessageID is optional and should only used for QoS 1 and 2
* */ * */
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, byte[] message, boolean retain, Integer messageID) { private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, byte[] message, boolean retain, Integer messageID) {
LOG.debug("publish2Subscribers republishing to existing subscribers that matches the topic " + topic);
for (final Subscription sub : subscriptions.matches(topic)) { for (final Subscription sub : subscriptions.matches(topic)) {
LOG.debug("found matching subscription on topic " + sub.getTopic());
if (qos == AbstractMessage.QOSType.MOST_ONE) { if (qos == AbstractMessage.QOSType.MOST_ONE) {
//QoS 0 //QoS 0
sendPublish(sub.getClientId(), topic, qos, message, false); sendPublish(sub.getClientId(), topic, qos, message, false);
@@ -360,13 +365,13 @@ class ProtocolProcessor {
UnsubAckMessage ackMessage = new UnsubAckMessage(); UnsubAckMessage ackMessage = new UnsubAckMessage();
ackMessage.setMessageID(messageID); ackMessage.setMessageID(messageID);
LOG.info("replying with UnsubAck to MSG ID {0}", messageID); LOG.info(String.format("replying with UnsubAck to MSG ID %s", messageID));
session.write(ackMessage); session.write(ackMessage);
} }
void processSubscribe(ServerChannel session, SubscribeMessage msg, String clientID, boolean cleanSession) { void processSubscribe(ServerChannel session, SubscribeMessage msg, String clientID, boolean cleanSession) {
LOG.debug("processSubscribe invoked"); LOG.info(String.format("processSubscribe invoked from client %s with msgID %d", clientID, msg.getMessageID()));
for (SubscribeMessage.Couple req : msg.subscriptions()) { for (SubscribeMessage.Couple req : msg.subscriptions()) {
AbstractMessage.QOSType qos = AbstractMessage.QOSType.values()[req.getQos()]; AbstractMessage.QOSType qos = AbstractMessage.QOSType.values()[req.getQos()];
@@ -382,7 +387,7 @@ class ProtocolProcessor {
for (int i = 0; i < msg.subscriptions().size(); i++) { for (int i = 0; i < msg.subscriptions().size(); i++) {
ackMessage.addType(AbstractMessage.QOSType.MOST_ONE); ackMessage.addType(AbstractMessage.QOSType.MOST_ONE);
} }
LOG.info("replying with SubAct to MSG ID " + msg.getMessageID()); LOG.info("replying with SubAck to MSG ID " + msg.getMessageID());
session.write(ackMessage); session.write(ackMessage);
} }
@@ -72,7 +72,7 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
private void disruptorPublish(MessagingEvent msgEvent) { private void disruptorPublish(MessagingEvent msgEvent) {
LOG.info("disruptorPublish publishing event " + msgEvent); LOG.debug("disruptorPublish publishing event " + msgEvent);
long sequence = m_ringBuffer.next(); long sequence = m_ringBuffer.next();
ValueEvent event = m_ringBuffer.get(sequence); ValueEvent event = m_ringBuffer.get(sequence);
@@ -79,7 +79,7 @@ public class SubscriptionsStore {
protected void addDirect(Subscription newSubscription) { protected void addDirect(Subscription newSubscription) {
TreeNode current = findMatchingNode(newSubscription.topic); TreeNode current = findMatchingNode(newSubscription.topic);
current.addSubcription(newSubscription); current.addSubscription(newSubscription);
} }
private TreeNode findMatchingNode(String topic) { private TreeNode findMatchingNode(String topic) {
@@ -24,7 +24,7 @@ class TreeNode {
this.m_token = topic; this.m_token = topic;
} }
void addSubcription(Subscription s) { void addSubscription(Subscription s) {
//avoid double registering //avoid double registering
if (m_subscriptions.contains(s)) { if (m_subscriptions.contains(s)) {
return; return;
@@ -82,7 +82,7 @@ class TreeNode {
for (TreeNode n : m_children) { for (TreeNode n : m_children) {
if (n.getToken().match(t)) { if (n.getToken().match(t)) {
//Create a copy of token, alse if navigate 2 sibling it //Create a copy of token, else if navigate 2 sibling it
//consumes 2 elements on the queue instead of one //consumes 2 elements on the queue instead of one
n.matches(new LinkedBlockingQueue<Token>(tokens), matchingSubs); n.matches(new LinkedBlockingQueue<Token>(tokens), matchingSubs);
} }