mqtt: fix: pinreq handler function exit condition

The previous version of the pingreq handler function leaves
the semaphore blocked if an error condition is detected.

This patch solves the above described situation.

Change-Id: I4897609fae3f6523244892ae38ffdc5ae85f852d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2016-08-05 19:15:58 -05:00 committed by Inaky Perez-Gonzalez
commit f8b30eada7

View file

@ -569,17 +569,18 @@ int mqtt_handle_pingreq(struct mqtt_app_ctx_t *app)
rc = mqtt_pack_pingresp(tx_buf); rc = mqtt_pack_pingresp(tx_buf);
if (rc != 0) { if (rc != 0) {
return -EINVAL; rc = -EINVAL;
goto error_mqtt_pack_pingresp;
} }
rc = netz_tx(netz_ctx, tx_buf); rc = netz_tx(netz_ctx, tx_buf);
if (rc != 0) { if (rc != 0) {
nano_sem_give(&app->sem); rc = -EIO;
return -EIO;
} }
error_mqtt_pack_pingresp:
nano_sem_give(&app->sem); nano_sem_give(&app->sem);
return 0; return rc;
} }
int mqtt_read(struct mqtt_app_ctx_t *app) int mqtt_read(struct mqtt_app_ctx_t *app)