Fix repeated "Error in poll" messages on Windows.

This occurs when only websockets listeners are defined.

Closes #1391. Thanks to stopak.
pull/1600/head
Roger A. Light 6 years ago
parent ed8964de56
commit dadd94e7c1

@ -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

@ -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);

Loading…
Cancel
Save