net/mqtt: Improve error handling in mqtt_rx_connack routine
Avoid undesired behaviors by exiting once an error is detected. Change-Id: Id8e6accd6cd096274fe1c40a615d290967f1d4b9 Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
parent
e4e74be208
commit
8619d9d625
1 changed files with 2 additions and 1 deletions
|
@ -415,6 +415,7 @@ int mqtt_rx_connack(struct mqtt_ctx *ctx, struct net_buf *rx, int clean_session)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else {
|
} else {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
|
goto exit_connect;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* previous session */
|
/* previous session */
|
||||||
|
@ -423,7 +424,7 @@ int mqtt_rx_connack(struct mqtt_ctx *ctx, struct net_buf *rx, int clean_session)
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
break;
|
goto exit_connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->connected = 1;
|
ctx->connected = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue