mirror of
https://github.com/emqx/neuron.git
synced 2026-10-22 01:05:56 +08:00
connection: add send log
This commit is contained in:
@@ -86,4 +86,15 @@ extern zlog_category_t *neuron;
|
||||
} \
|
||||
plog_debug(plugin, "%s", protocol_buf);
|
||||
|
||||
#define zlog_recv_protocol(log, bytes, n_byte) \
|
||||
char protocol_buf[2048] = { 0 }; \
|
||||
int offset = 0; \
|
||||
offset = snprintf(protocol_buf, sizeof(protocol_buf), "<<"); \
|
||||
for (int i = 0; i < n_byte; i++) { \
|
||||
offset += \
|
||||
snprintf(protocol_buf + offset, sizeof(protocol_buf) - offset, \
|
||||
" 0x%02hhX", bytes[i]); \
|
||||
} \
|
||||
zlog_debug(log, "%s", protocol_buf);
|
||||
|
||||
#endif
|
||||
@@ -769,6 +769,7 @@ void neu_conn_stream_consume(neu_conn_t *conn, void *context,
|
||||
ssize_t ret =
|
||||
neu_conn_recv(conn, recv_buf + offset, sizeof(recv_buf) - offset);
|
||||
if (ret > 0) {
|
||||
zlog_recv_protocol(conn->param.log, recv_buf + offset, ret);
|
||||
offset += ret;
|
||||
neu_protocol_unpack_buf_t protocol_buf = { 0 };
|
||||
neu_protocol_unpack_buf_init(&protocol_buf, recv_buf, offset);
|
||||
|
||||
Reference in New Issue
Block a user