Commits

Roger Light committed 6aae8fd

Reset errno before network read/write to avoid returning with EAGAIN too soon.

Comments (0)

Files changed (2)

  *	max_packets - the maximum number of packets to process in this call. Must
  *	              be >0. If set to 1, only a single packet will be processed
  *	              per call. Avoid setting too high if you have a high incoming
- *	              message rate.
+ *	              message rate. If you are publishing using QoS>0 then you
+ *	              should set this parameter to be larger than the number of
+ *	              messages published since the last call to <mosquitto_loop>,
+ *	              otherwise the outgoing message rate may not keep up with the
+ *	              calls to <mosquitto_publish> and a message backlog will
+ *	              occur.
  * 
  * Returns:
  *	MOSQ_ERR_SUCCESS -   on success.
  *	max_packets - the maximum number of packets to process in this call. Must
  *	              be >0. If set to 1, only a single packet will be processed
  *	              per call. Avoid setting too high if you have a high incoming
- *	              message rate.
+ *	              message rate. If you are publishing using QoS>0 then you
+ *	              should set this parameter to be larger than the number of
+ *	              messages published since the last call to <mosquitto_loop>,
+ *	              otherwise the outgoing message rate may not keep up with the
+ *	              calls to <mosquitto_publish> and a message backlog will
+ *	              occur.
  *
  * Returns:
  *	MOSQ_ERR_SUCCESS -   on success.
  *	mosq -        a valid mosquitto instance.
  *	max_packets - the maximum number of packets to process in this call. Must
  *	              be >0. If set to 1, only a single packet will be processed
- *	              per call.
+ *	              per call. Avoid setting too high if you have a high incoming
+ *	              message rate. If you are publishing using QoS>0 then you
+ *	              should set this parameter to be larger than the number of
+ *	              messages published since the last call to <mosquitto_loop>,
+ *	              otherwise the outgoing message rate may not keep up with the
+ *	              calls to <mosquitto_publish> and a message backlog will
+ *	              occur.
  *
  * Returns:
  *	MOSQ_ERR_SUCCESS -   on success.
 	unsigned long e;
 #endif
 	assert(mosq);
+	errno = 0;
 #ifdef WITH_TLS
 	if(mosq->ssl){
 		ret = SSL_read(mosq->ssl, buf, count);
 #endif
 	assert(mosq);
 
+	errno = 0;
 #ifdef WITH_TLS
 	if(mosq->ssl){
 		ret = SSL_write(mosq->ssl, buf, count);