Skip to content

Commit

Permalink
Fix connections retrying very rapidly in some situations.
Browse files Browse the repository at this point in the history
Thanks to Abilio Marques.
  • Loading branch information
ralight committed Mar 11, 2021
1 parent 891be8c commit f883824
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Broker:
Client library:
- Fix encrypted connections incorrectly connecting when the CA file passed to
`mosquitto_tls_set()` is empty or invalid. Closes #2130.
- Fix connections retrying very rapidly in some situations.

Build:
- Fix cmake epoll detection.
Expand Down
7 changes: 7 additions & 0 deletions lib/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
char pairbuf;
int maxfd = 0;

#ifndef WIN32
if(read(mosq->sockpairR, &pairbuf, 1) == 0){
}
#else
recv(mosq->sockpairR, &pairbuf, 1, 0);
#endif

local_timeout.tv_sec = reconnect_delay;
#ifdef HAVE_PSELECT
local_timeout.tv_nsec = 0;
Expand Down

0 comments on commit f883824

Please sign in to comment.