Fix default port problem when compiling clients using WITH_TLS=no.

This commit is contained in:
Roger A. Light 2018-08-15 14:34:56 +01:00
parent ab5af8f0b9
commit 3d3b7fc46f
2 changed files with 11 additions and 7 deletions

View File

@ -32,6 +32,10 @@ Library:
- Fix connection problems when mosquitto_loop_start() was called before - Fix connection problems when mosquitto_loop_start() was called before
mosquitto_connect_async(). Closes #848. mosquitto_connect_async(). Closes #848.
Clients:
- When compiled using WITH_TLS=no, the default port was incorrectly being set
to -1. This has been fixed.
Build: Build:
- Fixes for building on NetBSD. Closes #258. - Fixes for building on NetBSD. Closes #258.

View File

@ -978,20 +978,20 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg)
int rc; int rc;
int port; int port;
#ifdef WITH_TLS
if(cfg->port < 0){ if(cfg->port < 0){
#ifdef WITH_TLS
if(cfg->cafile || cfg->capath if(cfg->cafile || cfg->capath
#ifdef WITH_TLS_PSK # ifdef WITH_TLS_PSK
|| cfg->psk || cfg->psk
#endif # endif
){ ){
port = 8883; port = 8883;
}else{ }else
#endif
{
port = 1883; port = 1883;
} }
}else }else{
#endif
{
port = cfg->port; port = cfg->port;
} }