Check SSL_DATA_PENDING in mosquitto_loop_read()

Signed-off-by: Tamaki Nishino <otamachan@gmail.com>
This commit is contained in:
Tamaki Nishino
2018-12-05 11:39:50 +00:00
committed by Roger Light
parent 3a871828ac
commit d07864939a
+5 -7
View File
@@ -147,12 +147,10 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
}else{
if(mosq->sock != INVALID_SOCKET){
if(FD_ISSET(mosq->sock, &readfds)){
do{
rc = mosquitto_loop_read(mosq, max_packets);
if(rc || mosq->sock == INVALID_SOCKET){
return rc;
}
}while(SSL_DATA_PENDING(mosq));
rc = mosquitto_loop_read(mosq, max_packets);
if(rc || mosq->sock == INVALID_SOCKET){
return rc;
}
}
if(mosq->sockpairR != INVALID_SOCKET && FD_ISSET(mosq->sockpairR, &readfds)){
#ifndef WIN32
@@ -368,7 +366,7 @@ int mosquitto_loop_read(struct mosquitto *mosq, int max_packets)
/* Queue len here tells us how many messages are awaiting processing and
* have QoS > 0. We should try to deal with that many in this loop in order
* to keep up. */
for(i=0; i<max_packets; i++){
for(i=0; i<max_packets || SSL_DATA_PENDING(mosq); i++){
#ifdef WITH_SOCKS
if(mosq->socks5_host){
rc = socks5__read(mosq);