update: more debug messages for send functions

This commit is contained in:
ngn
2024-08-09 02:25:52 +03:00
parent d75b8b9c1b
commit 544df2a4ab
5 changed files with 25 additions and 682 deletions

View File

@ -112,7 +112,7 @@ bool lm_mptp_server_send(int sock, lm_mptp_t *packet) {
}
char buffer[sizeof(packet->header) + packet->header.host_size + packet->header.data_size];
ssize_t total = sizeof(buffer), used = 0;
ssize_t total = sizeof(buffer), used = 0, buflen = total;
packet->header.flags = htons(packet->header.flags);
@ -120,13 +120,13 @@ bool lm_mptp_server_send(int sock, lm_mptp_t *packet) {
copy_to_buffer(buffer, packet->host, packet->header.host_size, &total, &used);
copy_to_buffer(buffer, packet->data, packet->header.data_size, &total, &used);
pdebug(__func__, "printing the packet dump");
pdebug_binary(buffer, sizeof(buffer));
if (send(sock, buffer, sizeof(buffer), 0) < 0) {
if (send(sock, buffer, buflen, 0) < 0) {
lm_error_set(LM_ERR_MPTPSendFail);
return false;
}
pdebug(__func__, "printing the packet dump (%lu bytes)", buflen);
pdebug_binary(buffer, buflen);
return true;
}