Rename reload_type -> bridge_reload_type, plus doc updates.

pull/2053/head
Roger A. Light 5 years ago
parent 4eb2b0ee1b
commit 0aecb51fcd

@ -2037,6 +2037,24 @@ topic clients/total in 0 test/mosquitto/org/ $SYS/broker/
can be used on one bridge at once.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>bridge_reload_type</option> [ lazy | immediate ]</term>
<listitem>
<para>If you change bridge options in the configuration file,
those configuration changes are applied during a bridge
reconnection. The <option>bridge_reload_type<option> option
determines when that reconnection happens, and can be set to either
<replaceable>lazy</replaceable> or <replaceable>immediate</replaceable>.</para>
<para><replaceable>lazy</replaceable> is the default, and means
that any connected bridge will remain in its current state until
a natural reconnection happens, at which point the new configuration
will be used.</para>
<para><replaceable>immediate</replaceable> forces a reconnection and so
uses the new configuration straight away.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>bridge_require_ocsp</option> [ true | false ]</term>
<listitem>
@ -2057,24 +2075,6 @@ topic clients/total in 0 test/mosquitto/org/ $SYS/broker/
connection to succeed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>reload_type</option> [ lazy | immediate ]</term>
<listitem>
<para>Configuration changes are applied during a bridge
reconnection. This option helps deciding when that
reconnection happens. It can be one of two types:
<replaceable>lazy</replaceable> and <replaceable>immediate</replaceable>.
</para>
<para><replaceable>lazy</replaceable> is the default,
and means that any connected bridge will remain in
that state. The configuration changes will be taken
during a later, natural reconnection.</para>
<para><replaceable>immediate</replaceable> forces a
reconnection in order to take the new values.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>

@ -806,6 +806,18 @@
# Set to 0 for "unlimited".
#bridge_max_packet_size 0
# If you change bridge options in the configuration file, those configuration
# changes are applied during a bridge reconnection. The bridge_reload_type
# option determines when that reconnection happens, and can be set to either
# lazy or immediate.
#
# lazy is the default, and means that any connected bridge will remain in its
# current state until a natural reconnection happens, at which point the new
# configuration is used.
#
# immediate forces a reconnection and so uses the new configuration straight
# away.
#bridge_reload_type lazy
# -----------------------------------------------------------------
# Certificate based SSL/TLS support

@ -1145,6 +1145,29 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
if(conf__parse_string(&token, "bridge_psk", &cur_bridge->tls_psk, saveptr)) return MOSQ_ERR_INVAL;
#else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge and/or TLS-PSK support not available.");
#endif
}else if(!strcmp(token, "bridge_reload_type")){
#ifdef WITH_BRIDGE
if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL;
}
token = strtok_r(NULL, " ", &saveptr);
if(token){
if(!strcmp(token, "lazy")){
cur_bridge->reload_type = brt_lazy;
}else if(!strcmp(token, "immediate")){
cur_bridge->reload_type = brt_immediate;
}else{
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge_reload_type value in configuration (%s).", token);
return MOSQ_ERR_INVAL;
}
}else{
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty bridge_reload_type value in configuration.");
return MOSQ_ERR_INVAL;
}
#else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
#endif
}else if(!strcmp(token, "bridge_tls_version")){
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
@ -1940,29 +1963,6 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
}
#else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
#endif
}else if(!strcmp(token, "reload_type")){
#ifdef WITH_BRIDGE
if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL;
}
token = strtok_r(NULL, " ", &saveptr);
if(token){
if(!strcmp(token, "lazy")){
cur_bridge->reload_type = brt_lazy;
}else if(!strcmp(token, "immediate")){
cur_bridge->reload_type = brt_immediate;
}else{
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid reload_type value in configuration (%s).", token);
return MOSQ_ERR_INVAL;
}
}else{
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty reload_type value in configuration.");
return MOSQ_ERR_INVAL;
}
#else
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
#endif
}else if(!strcmp(token, "socket_domain")){
if(reload) continue; /* Listeners not valid for reloading. */

@ -17,7 +17,7 @@ def write_config(filename, port1, port2, subtopic, reload_immediate=False):
f.write("notifications false\n")
f.write("restart_timeout 1\n")
if reload_immediate:
f.write("reload_type immediate")
f.write("bridge_reload_type immediate")
def accept_new_connection(sock):

Loading…
Cancel
Save