diff --git a/ChangeLog.txt b/ChangeLog.txt index 12e3341a5c..765d80d667 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -11,6 +11,8 @@ Broker: - Fix Will for v5 clients not being sent if will delay interval was greater than the session expiry interval. Closes #1401. - Fix CRL file not being reloaded on HUP. Closes #35. +- Fix repeated "Error in poll" messages on Windows when only websockets + listeners are defined. Closes #1391. Client library: - Fix reconnect backoff for the situation where connections are dropped rather diff --git a/src/loop.c b/src/loop.c index 2588295409..b72534c45a 100644 --- a/src/loop.c +++ b/src/loop.c @@ -532,7 +532,18 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li } #else if(fdcount == -1){ - log__printf(NULL, MOSQ_LOG_ERR, "Error in poll: %s.", strerror(errno)); +# ifdef WIN32 + if(pollfd_index == 0 && WSAGetLastError() == WSAEINVAL){ + /* WSAPoll() immediately returns an error if it is not given + * any sockets to wait on. This can happen if we only have + * websockets listeners. Sleep a little to prevent a busy loop. + */ + Sleep(10); + }else +# endif + { + log__printf(NULL, MOSQ_LOG_ERR, "Error in poll: %s.", strerror(errno)); + } }else{ loop_handle_reads_writes(db, pollfds);