Skip to content

Commit

Permalink
mosquitto_loop_forever now quits after a fatal error, rather than bli…
Browse files Browse the repository at this point in the history
…ndly retrying.
  • Loading branch information
ralight committed Sep 29, 2014
1 parent 950c4ed commit e9c18f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Clients:
- Both clients can now load default configuration options from a file.
- Add -1 (oneshot) option to mosquitto_sub.

Client library:
- mosquitto_loop_forever now quits after a fatal error, rather than blindly
retrying.

1.3.2 - 2014xxxx
================

Expand Down
16 changes: 16 additions & 0 deletions lib/mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,22 @@ int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)
reconnects = 0;
}
}while(run && rc == MOSQ_ERR_SUCCESS);
/* Quit after fatal errors. */
switch(rc){
case MOSQ_ERR_NOMEM:
case MOSQ_ERR_PROTOCOL:
case MOSQ_ERR_INVAL:
case MOSQ_ERR_NOT_FOUND:
case MOSQ_ERR_TLS:
case MOSQ_ERR_PAYLOAD_SIZE:
case MOSQ_ERR_NOT_SUPPORTED:
case MOSQ_ERR_AUTH:
case MOSQ_ERR_ACL_DENIED:
case MOSQ_ERR_UNKNOWN:
case MOSQ_ERR_ERRNO:
case MOSQ_ERR_EAI:
return rc;
}
if(errno == EPROTO){
return rc;
}
Expand Down

0 comments on commit e9c18f8

Please sign in to comment.