Clients: Give warning if keepalive too low.
This commit is contained in:
parent
1191a42c2e
commit
8e7e4a9d9a
@ -689,8 +689,8 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
|
|||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
cfg->keepalive = atoi(argv[i+1]);
|
cfg->keepalive = atoi(argv[i+1]);
|
||||||
if(cfg->keepalive>65535){
|
if(cfg->keepalive<5 || cfg->keepalive>UINT16_MAX){
|
||||||
fprintf(stderr, "Error: Invalid keepalive given: %d\n", cfg->keepalive);
|
fprintf(stderr, "Error: Invalid keepalive given, it must be between 5 and 65535 inclusive.\n\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ static int mosquitto__connect_init(struct mosquitto *mosq, const char *host, int
|
|||||||
|
|
||||||
if(!mosq) return MOSQ_ERR_INVAL;
|
if(!mosq) return MOSQ_ERR_INVAL;
|
||||||
if(!host || port < 0 || port > UINT16_MAX) return MOSQ_ERR_INVAL;
|
if(!host || port < 0 || port > UINT16_MAX) return MOSQ_ERR_INVAL;
|
||||||
if(keepalive < 5 || keepalive > UINT16_MAX) return MOSQ_ERR_INVAL;
|
if(keepalive != 0 && (keepalive < 5 || keepalive > UINT16_MAX)) return MOSQ_ERR_INVAL;
|
||||||
|
|
||||||
/* Only MQTT v3.1 requires a client id to be sent */
|
/* Only MQTT v3.1 requires a client id to be sent */
|
||||||
if(mosq->id == NULL && (mosq->protocol == mosq_p_mqtt31)){
|
if(mosq->id == NULL && (mosq->protocol == mosq_p_mqtt31)){
|
||||||
|
Loading…
Reference in New Issue
Block a user