Skip to content

Commit

Permalink
Merge pull request #2145 from abiliojr/empty_sockpairR
Browse files Browse the repository at this point in the history
Fully empty sockpairR on interruptible_sleep
  • Loading branch information
ralight committed Mar 22, 2021
2 parents 1c6571a + dd4a64b commit 0f9e579
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
int maxfd = 0;

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

local_timeout.tv_sec = reconnect_delay;
Expand Down

0 comments on commit 0f9e579

Please sign in to comment.