Skip to content

Commit

Permalink
* MDF [log] add log in send start
Browse files Browse the repository at this point in the history
Signed-off-by: wayne <[email protected]>
  • Loading branch information
StargazerWayne committed Dec 29, 2023
1 parent 537d387 commit 14befcc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/mqtt/transport/tcp/mqtt_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "core/nng_impl.h"
#include "core/sockimpl.h"
#include "nng/mqtt/mqtt_client.h"
#include "nng/supplemental/nanolib/log.h"
#include "supplemental/mqtt/mqtt_msg.h"

// TCP transport. Platform specific TCP operations must be
Expand Down Expand Up @@ -914,6 +915,19 @@ mqtt_tcptran_pipe_send_start(mqtt_tcptran_pipe *p)
iov[niov].iov_len = nni_msg_len(msg);
niov++;
}

int msg_body_len = 30 < nni_msg_len(msg) ? 30 : nni_msg_len(msg);

Check warning on line 919 in src/mqtt/transport/tcp/mqtt_tcp.c

View check run for this annotation

Codecov / codecov/patch

src/mqtt/transport/tcp/mqtt_tcp.c#L919

Added line #L919 was not covered by tests

char *data = iov[0].iov_buf;
for (int i = 0; i < nni_msg_header_len(msg);++i) {
log_debug("msg header %d: %x", i, data[i]);

Check warning on line 923 in src/mqtt/transport/tcp/mqtt_tcp.c

View check run for this annotation

Codecov / codecov/patch

src/mqtt/transport/tcp/mqtt_tcp.c#L921-L923

Added lines #L921 - L923 were not covered by tests
}

data = iov[1].iov_buf;
for (int i = 0; i < msg_body_len; ++i) {
log_debug("msg body %d: %x", i, data[i]);

Check warning on line 928 in src/mqtt/transport/tcp/mqtt_tcp.c

View check run for this annotation

Codecov / codecov/patch

src/mqtt/transport/tcp/mqtt_tcp.c#L926-L928

Added lines #L926 - L928 were not covered by tests
}

nni_aio_set_iov(txaio, niov, iov);
nng_stream_send(p->conn, txaio);
}
Expand Down

0 comments on commit 14befcc

Please sign in to comment.