update: fixing the debug messages for client functions

This commit is contained in:
ngn
2024-08-09 02:37:06 +03:00
parent 544df2a4ab
commit 89fe97ee8e
2 changed files with 658 additions and 4 deletions

View File

@ -66,7 +66,7 @@ bool lm_mptp_client_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);
@ -74,14 +74,14 @@ bool lm_mptp_client_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) {
lm_error_set(LM_ERR_MPTPSendFail);
return false;
}
pdebug(__func__, "printing the packet dump (%lu bytes)", buflen);
pdebug_binary(buffer, buflen);
return true;
}