1
0
mirror of https://github.com/eclipse/mosquitto.git synced 2025-05-09 01:01:11 +08:00

Fix websockets connections blocking non-ws connections on Windows.

Closes #1934. Thanks to sectokia and jarapa9.
This commit is contained in:
Roger A. Light 2020-12-22 16:48:57 +00:00
parent ce30f811ba
commit 97d9f471c3
3 changed files with 5 additions and 6 deletions

View File

@ -6,6 +6,8 @@ Broker:
- Fix dynamic security configuration possibly not being reloaded on Windows
only. Closes #1962.
- Add more log messages for dynsec load/save error conditions.
- Fix websockets connections blocking non-websockets connections on Windows.
Closes #1934.
Build:
- Fix man pages not being built when using CMake. Closes #1969.

View File

@ -84,7 +84,7 @@ int mux_poll__init(struct mosquitto__listener_sock *listensock, int listensock_c
pollfd_max = (size_t)sysconf(_SC_OPEN_MAX);
#endif
pollfds = mosquitto__malloc(sizeof(struct pollfd)*pollfd_max);
pollfds = mosquitto__calloc(pollfd_max, sizeof(struct pollfd));
if(!pollfds){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");
return MOSQ_ERR_NOMEM;
@ -145,7 +145,7 @@ int mux_poll__add_in(struct mosquitto *context)
if(context->pollfd_index != -1){
pollfds[context->pollfd_index].fd = context->sock;
pollfds[context->pollfd_index].events = POLLIN | POLLPRI;
pollfds[context->pollfd_index].events = POLLIN;
pollfds[context->pollfd_index].revents = 0;
}else{
for(i=0; i<pollfd_max; i++){
@ -230,7 +230,7 @@ int mux_poll__handle(struct mosquitto__listener_sock *listensock, int listensock
loop_handle_reads_writes(pollfds);
for(i=0; i<listensock_count; i++){
if(pollfds[i].revents & (POLLIN | POLLPRI)){
if(pollfds[i].revents & POLLIN){
#ifdef WITH_WEBSOCKETS
if(listensock[i].listener->ws_context){
/* Nothing needs to happen here, because we always call lws_service in the loop.

View File

@ -188,9 +188,6 @@ static int callback_mqtt(
if(mosq->sock != INVALID_SOCKET){
HASH_DELETE(hh_sock, db.contexts_by_sock, mosq);
mosq->sock = INVALID_SOCKET;
#ifndef WITH_EPOLL
mosq->pollfd_index = -1;
#endif
mux__delete(mosq);
}
mosq->wsi = NULL;