Report error string on connection failure rather than error code.

pull/211/merge
Roger A. Light 10 years ago
parent 2a880cf5b3
commit c1974e5402

@ -1,6 +1,13 @@
Broker:
- Fix incorrect bridge notification on initial connection. Closes #467096. - Fix incorrect bridge notification on initial connection. Closes #467096.
- Build fixes for OpenBSD. - Build fixes for OpenBSD.
Client library:
- Add missing error strings to mosquitto_strerror.
Clients:
- Report error string on connection failure rather than error code.
1.4.2 - 20150507 1.4.2 - 20150507
================ ================

@ -755,7 +755,7 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg)
#endif #endif
fprintf(stderr, "Error: %s\n", err); fprintf(stderr, "Error: %s\n", err);
}else{ }else{
fprintf(stderr, "Unable to connect (%d).\n", rc); fprintf(stderr, "Unable to connect (%s).\n", mosquitto_strerror(rc));
} }
} }
mosquitto_lib_cleanup(); mosquitto_lib_cleanup();

@ -1273,6 +1273,8 @@ void mosquitto_user_data_set(struct mosquitto *mosq, void *userdata)
const char *mosquitto_strerror(int mosq_errno) const char *mosquitto_strerror(int mosq_errno)
{ {
switch(mosq_errno){ switch(mosq_errno){
case MOSQ_ERR_CONN_PENDING:
return "Connection pending.";
case MOSQ_ERR_SUCCESS: case MOSQ_ERR_SUCCESS:
return "No error."; return "No error.";
case MOSQ_ERR_NOMEM: case MOSQ_ERR_NOMEM:
@ -1303,6 +1305,8 @@ const char *mosquitto_strerror(int mosq_errno)
return "Unknown error."; return "Unknown error.";
case MOSQ_ERR_ERRNO: case MOSQ_ERR_ERRNO:
return strerror(errno); return strerror(errno);
case MOSQ_ERR_EAI:
return "Lookup error.";
case MOSQ_ERR_PROXY: case MOSQ_ERR_PROXY:
return "Proxy error."; return "Proxy error.";
default: default:

Loading…
Cancel
Save