Skip to content

Commit

Permalink
increase payload size to 2048 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
olsky committed Jun 6, 2016
1 parent 96c32f6 commit 2d48198
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions c/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define PACK_MAJOR 1
#define PACK_MINOR 0
#define PACK_REVISION 3
#define PACK_REVISION 4
#define PACK_VERSION_NUMBER (PACK_MAJOR*10000+PACK_MINOR*100+PACK_REVISION)


Expand Down Expand Up @@ -695,7 +695,8 @@ c_mqtt_pub(term_t conn, term_t topic, term_t payload, term_t options)

swi_mqtt *m;
int mid;
char buf[81];
int buf_len = 2048;
char buf[buf_len];
char* mqtt_topic = NULL;
char* mqtt_payload = NULL;
char* payload_type = NULL;
Expand Down Expand Up @@ -776,8 +777,8 @@ c_mqtt_pub(term_t conn, term_t topic, term_t payload, term_t options)

_LOG("--- (f-c) c_mqtt_pub > qos: %d retain: %d payload: %s\n", qos, retain, mqtt_payload);

memset(buf, 0, 81*sizeof(char));
snprintf(buf, 80, "%s", mqtt_payload);
memset(buf, 0, (buf_len+1)*sizeof(char));
snprintf(buf, buf_len, "%s", mqtt_payload);

_LOG("--- (f-c) c_mqtt_pub > publish...\n");
mosq_rc = mosquitto_publish(m->mosq, &mid, mqtt_topic, strlen(buf), buf, qos, retain);
Expand Down
Binary file modified lib/x86_64-linux/mqtt.so
Binary file not shown.
4 changes: 2 additions & 2 deletions pack.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name(mqtt).
title('mqtt - pub/sub pack for SWI-Prolog using mosquitto').
version('1.0.3').
version('1.0.4').
author('Oleh Lozynskyy', 'oleh.lozynskyy+github@gmail.com').
packager('Oleh Lozynskyy', 'oleh.lozynskyy+github@gmail.com').
maintainer('Oleh Lozynskyy', 'oleh.lozynskyy+github@gmail.com').
home('https://github.com/olsky/swi-mqtt-pack').
download('https://github.com/olsky/swi-mqtt-pack/releases/download/v1.0.3/mqtt-1.0.3.zip').
download('https://github.com/olsky/swi-mqtt-pack/releases/download/v1.0.4/mqtt-1.0.4.zip').

0 comments on commit 2d48198

Please sign in to comment.