Client no longer generates random client ids for v3.1.1 clients

These are now expected to be generated on the broker. This matches the
behaviour for v5 clients.

Closes #291.
pull/1430/head
Roger A. Light 6 years ago
parent c1e488cb88
commit ff676811d3

@ -3,6 +3,11 @@ Broker:
then try "nobody" instead. This reduces the burden on users installing then try "nobody" instead. This reduces the burden on users installing
Mosquitto themselves. Mosquitto themselves.
Client library:
- Client no longer generates random client ids for v3.1.1 clients, these are
now expected to be generated on the broker. This matches the behaviour for
v5 clients. Closes #291.
Clients: Clients:
- Add timeout return code (27) for `mosquitto_sub -W <secs>` and - Add timeout return code (27) for `mosquitto_sub -W <secs>` and
`mosquitto_rr -W <secs>`. Closes #275. `mosquitto_rr -W <secs>`. Closes #275.

@ -44,7 +44,8 @@ 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) return MOSQ_ERR_INVAL; if(!host || port <= 0) return MOSQ_ERR_INVAL;
if(mosq->id == NULL && (mosq->protocol == mosq_p_mqtt31 || mosq->protocol == mosq_p_mqtt311)){ /* Only MQTT v3.1 requires a client id to be sent */
if(mosq->id == NULL && (mosq->protocol == mosq_p_mqtt31)){
mosq->id = (char *)mosquitto__calloc(24, sizeof(char)); mosq->id = (char *)mosquitto__calloc(24, sizeof(char));
if(!mosq->id){ if(!mosq->id){
return MOSQ_ERR_NOMEM; return MOSQ_ERR_NOMEM;

Loading…
Cancel
Save