summaryrefslogtreecommitdiff
path: root/lib/mqtt.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-11-02 17:34:04 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-11-02 22:49:36 +0100
commitd70a5b5a0f5e36781a39e2c955139c81d41355c1 (patch)
tree54bb308146bdbd9e8da1fd228b8757967ac8014e /lib/mqtt.c
parent606d213766fb94a4653ec41ef3b91cc0a96b9570 (diff)
downloadcurl-d70a5b5a0f5e36781a39e2c955139c81d41355c1.tar.gz
sendf: move the verbose-check into Curl_debug
Saves us from having the same check done everywhere. Closes #6159
Diffstat (limited to 'lib/mqtt.c')
-rw-r--r--lib/mqtt.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/mqtt.c b/lib/mqtt.c
index c0e9a2b75..7074210ac 100644
--- a/lib/mqtt.c
+++ b/lib/mqtt.c
@@ -114,7 +114,7 @@ static CURLcode mqtt_send(struct connectdata *conn,
struct MQTT *mq = data->req.protop;
ssize_t n;
result = Curl_write(conn, sockfd, buf, len, &n);
- if(!result && data->set.verbose)
+ if(!result)
Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
if(len != (size_t)n) {
size_t nsend = len - n;
@@ -185,8 +185,7 @@ static CURLcode mqtt_verify_connack(struct connectdata *conn)
if(result)
goto fail;
- if(data->set.verbose)
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
/* fixme */
if(nread < MQTT_CONNACK_LEN) {
@@ -298,8 +297,7 @@ static CURLcode mqtt_verify_suback(struct connectdata *conn)
if(result)
goto fail;
- if(conn->data->set.verbose)
- Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
+ Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
/* fixme */
if(nread < MQTT_SUBACK_LEN) {
@@ -486,8 +484,7 @@ static CURLcode mqtt_read_publish(struct connectdata *conn,
result = CURLE_PARTIAL_FILE;
goto end;
}
- if(data->set.verbose)
- Curl_debug(data, CURLINFO_DATA_IN, (char *)pkt, (size_t)nread);
+ Curl_debug(data, CURLINFO_DATA_IN, (char *)pkt, (size_t)nread);
mq->npacket -= nread;
k->bytecount += nread;
@@ -558,8 +555,7 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
result = Curl_read(conn, sockfd, (char *)&mq->firstbyte, 1, &nread);
if(result)
break;
- if(data->set.verbose)
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
/* remember the first byte */
mq->npacket = 0;
mqstate(conn, MQTT_REMAINING_LENGTH, MQTT_NOSTATE);
@@ -569,8 +565,7 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
result = Curl_read(conn, sockfd, (char *)&byte, 1, &nread);
if(result)
break;
- if(data->set.verbose)
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
pkt[mq->npacket++] = byte;
} while((byte & 0x80) && (mq->npacket < 4));
if(result)