Skip to content

Commit

Permalink
net: tests: Fix mqtt_subscriber
Browse files Browse the repository at this point in the history
Remove redundant mqtt_init() call, and fix sense of test for
mqtt_init().

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
  • Loading branch information
Gil Pitney committed Jun 11, 2018
1 parent 41f0b5e commit 19dc3ce
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,31 +247,19 @@ static int init_network(void)

/* connect, disconnect and malformed may be set to NULL */
client_ctx.mqtt_ctx.connect = connect_cb;

client_ctx.mqtt_ctx.disconnect = disconnect_cb;

client_ctx.mqtt_ctx.malformed = malformed_cb;

client_ctx.mqtt_ctx.subscribe = subscriber_cb;

client_ctx.mqtt_ctx.unsubscribe = unsubscribe_cb;

client_ctx.mqtt_ctx.net_init_timeout = APP_NET_INIT_TIMEOUT;

client_ctx.mqtt_ctx.net_timeout = APP_TX_RX_TIMEOUT;

client_ctx.mqtt_ctx.peer_addr_str = SERVER_ADDR;

client_ctx.mqtt_ctx.peer_port = SERVER_PORT;

/* Publisher apps TX the MQTT PUBLISH msg */
client_ctx.mqtt_ctx.publish_rx = publish_rx_cb;

rc = mqtt_init(&client_ctx.mqtt_ctx, MQTT_APP_SUBSCRIBER);
if (rc != 0) {
goto exit_app;
}

/* The connect message will be sent to the MQTT server (broker).
* If clean_session here is 0, the mqtt_ctx clean_session variable
* will be set to 0 also. Please don't do that, set always to 1.
Expand All @@ -292,7 +280,7 @@ static int init_network(void)
}

rc = mqtt_connect(&client_ctx.mqtt_ctx);
if (!rc) {
if (rc != 0) {
goto exit_app;
}

Expand Down

0 comments on commit 19dc3ce

Please sign in to comment.