Merge 1.3.2 branch in 1.4 branch.

This commit is contained in:
Roger A. Light 2014-05-26 13:21:20 +01:00
commit 2db22f3abd
11 changed files with 55 additions and 4 deletions

View File

@ -65,6 +65,8 @@ else (${WITH_TLS} STREQUAL ON)
set (OPENSSL_INCLUDE_DIR "")
endif (${WITH_TLS} STREQUAL ON)
option(WITH_SRV "Include SRV lookup support?" ON)
# ========================================
# Include projects
# ========================================

View File

@ -23,6 +23,13 @@ Broker:
Client library:
- Fix topic matching edge case.
- Fix callback deadlocks after calling mosquitto_disconnect(), when using the
threaded interfaces. Closes bug #1313725.
- Fix SRV support when building with CMake.
General:
- Use $(STRIP) for stripping binaries when installing, to allow easier cross
compilation.
1.3.1 - 20140324
================

View File

@ -4,6 +4,10 @@ link_directories(${mosquitto_BINARY_DIR}/lib)
set(shared_src client_shared.c client_shared.h)
if (${WITH_SRV} STREQUAL ON)
add_definitions("-DWITH_SRV")
endif (${WITH_SRV} STREQUAL ON)
add_executable(mosquitto_pub pub_client.c ${shared_src})
add_executable(mosquitto_sub sub_client.c ${shared_src})

View File

@ -406,8 +406,10 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
}else{
cfg->pub_mode = MSGMODE_STDIN_FILE;
}
#ifdef WITH_SRV
}else if(!strcmp(argv[i], "-S")){
cfg->use_srv = true;
#endif
}else if(!strcmp(argv[i], "-t") || !strcmp(argv[i], "--topic")){
if(i==argc-1){
fprintf(stderr, "Error: -t argument given but no topic specified.\n\n");

View File

@ -201,7 +201,11 @@ void print_usage(void)
printf("mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.\n");
printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision);
printf("Usage: mosquitto_pub [-h host] [-p port] [-q qos] [-r] {-f file | -l | -n | -m message} -t topic\n");
#ifdef WITH_SRV
printf(" [-A bind_address] [-S]\n");
#else
printf(" [-A bind_address]\n");
#endif
printf(" [-i id] [-I id_prefix]\n");
printf(" [-d] [--quiet]\n");
printf(" [-M max_inflight]\n");
@ -231,7 +235,9 @@ void print_usage(void)
printf(" -q : quality of service level to use for all messages. Defaults to 0.\n");
printf(" -r : message should be retained.\n");
printf(" -s : read message from stdin, sending the entire input as a message.\n");
#ifdef WITH_SRV
printf(" -S : use SRV lookups to determine which host to connect to.\n");
#endif
printf(" -t : mqtt topic to publish to.\n");
printf(" -u : provide a username (requires MQTT 3.1 broker)\n");
printf(" -P : provide a password (requires MQTT 3.1 broker)\n");

View File

@ -127,7 +127,11 @@ void print_usage(void)
printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision);
printf("Usage: mosquitto_sub [-c] [-h host] [-k keepalive] [-p port] [-q qos] [-R] -t topic ...\n");
printf(" [-1] [-T filter_out]\n");
#ifdef WITH_SRV
printf(" [-A bind_address] [-S]\n");
#else
printf(" [-A bind_address]\n");
#endif
printf(" [-i id] [-I id_prefix]\n");
printf(" [-d] [-N] [--quiet] [-v]\n");
printf(" [-u username [-P password]]\n");
@ -154,7 +158,9 @@ void print_usage(void)
printf(" -p : network port to connect to. Defaults to 1883.\n");
printf(" -q : quality of service level to use for the subscription. Defaults to 0.\n");
printf(" -R : do not print stale messages (those with retain set).\n");
#ifdef WITH_SRV
printf(" -S : use SRV lookups to determine which host to connect to.\n");
#endif
printf(" -t : mqtt topic to subscribe to. May be repeated multiple times.\n");
printf(" -u : provide a username (requires MQTT 3.1 broker)\n");
printf(" -v : print published messages verbosely.\n");

View File

@ -50,8 +50,8 @@ if (WIN32)
set (LIBRARIES ${LIBRARIES} ws2_32)
endif (WIN32)
option(WITH_SRV "Include SRV lookup support?" ON)
if (${WITH_SRV} STREQUAL ON)
add_definitions("-DWITH_SRV")
set (LIBRARIES ${LIBRARIES} cares)
endif (${WITH_SRV} STREQUAL ON)

View File

@ -776,6 +776,7 @@ int _mosquitto_packet_write(struct mosquitto *mosq)
mosq->on_disconnect(mosq, mosq->userdata, 0);
mosq->in_callback = false;
}
pthread_mutex_unlock(&mosq->callback_mutex);
pthread_mutex_unlock(&mosq->current_out_packet_mutex);
return MOSQ_ERR_SUCCESS;
}

View File

@ -40,7 +40,14 @@ static void srv_callback(void *arg, int status, int timeouts, unsigned char *abu
}
}else{
_mosquitto_log_printf(mosq, MOSQ_LOG_ERR, "Error: SRV lookup failed (%d).", status);
exit(1);
/* FIXME - calling on_disconnect here isn't correct. */
pthread_mutex_lock(&mosq->callback_mutex);
if(mosq->on_disconnect){
mosq->in_callback = true;
mosq->on_disconnect(mosq, mosq->userdata, 2);
mosq->in_callback = false;
}
pthread_mutex_unlock(&mosq->callback_mutex);
}
}
#endif

View File

@ -902,6 +902,22 @@
to 60 seconds.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>local_password</option> <replaceable>password</replaceable></term>
<listitem>
<para>Configure the password to be used when connecting
this bridge to the local broker. This may be important
when authentication and ACLs are being used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>local_username</option> <replaceable>username</replaceable></term>
<listitem>
<para>Configure the username to be used when connecting
this bridge to the local broker. This may be important
when authentication and ACLs are being used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>notifications</option> [ true | false ]</term>
<listitem>

View File

@ -100,10 +100,10 @@ mosquitto_passwd.o : mosquitto_passwd.c
install : all
$(INSTALL) -d ${DESTDIR}$(prefix)/sbin
$(INSTALL) -s mosquitto ${DESTDIR}${prefix}/sbin/mosquitto
$(INSTALL) -s --strip-program=$(STRIP) mosquitto ${DESTDIR}${prefix}/sbin/mosquitto
$(INSTALL) mosquitto_plugin.h ${DESTDIR}${prefix}/include/mosquitto_plugin.h
ifeq ($(WITH_TLS),yes)
$(INSTALL) -s mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd
$(INSTALL) -s --strip-program=$(STRIP) mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd
endif
uninstall :