aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV.Krishn <vkrishn4@gmail.com>2015-03-12 22:59:46 +0530
committerV.Krishn <vkrishn4@gmail.com>2015-03-12 22:59:46 +0530
commit1ff9b8cd6d1a78bb75ddb7affb2e25a7245dd6aa (patch)
treefc442ab8e3fa5ef126d6e1e8e7819decf80236e2
parent0ec649e584687e3ef4491051746cb52907d58209 (diff)
downloadmqtt-dirpub-1ff9b8cd6d1a78bb75ddb7affb2e25a7245dd6aa.tar.bz2
add missed changes from mosquitto v1.4.0
-rw-r--r--client_shared.c2
-rw-r--r--client_shared.h2
-rw-r--r--sub_client.c10
3 files changed, 12 insertions, 2 deletions
diff --git a/client_shared.c b/client_shared.c
index 8862208..c98775e 100644
--- a/client_shared.c
+++ b/client_shared.c
@@ -13,7 +13,7 @@ and the Eclipse Distribution License is available at
Contributors:
Roger Light - initial implementation and documentation.
- V Krishn - implement dirpub.
+ V Krishn - implement dirpub.
*/
diff --git a/client_shared.h b/client_shared.h
index 8fdaa8b..f4a5c22 100644
--- a/client_shared.h
+++ b/client_shared.h
@@ -13,7 +13,7 @@ and the Eclipse Distribution License is available at
Contributors:
Roger Light - initial implementation and documentation.
- V Krishn - implement dirpub.
+ V Krishn - implement dirpub.
*/
#ifndef _CLIENT_CONFIG_H
diff --git a/sub_client.c b/sub_client.c
index 95d6580..474e051 100644
--- a/sub_client.c
+++ b/sub_client.c
@@ -13,6 +13,7 @@ and the Eclipse Distribution License is available at
Contributors:
Roger Light - initial implementation and documentation.
+ V Krishn - implement dirpub.
*/
#include <assert.h>
@@ -300,6 +301,8 @@ void my_message_file_callback(struct mosquitto *mosq, void *obj, const struct mo
int i;
bool res;
+ if(process_messages == false) return;
+
assert(obj);
cfg = (struct mosq_config *)obj;
@@ -357,6 +360,13 @@ void my_message_file_callback(struct mosquitto *mosq, void *obj, const struct mo
}
fclose(fptr);
}
+ if(cfg->msg_count>0){
+ msg_count++;
+ if(cfg->msg_count == msg_count){
+ process_messages = false;
+ mosquitto_disconnect(mosq);
+ }
+ }
}
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)