update: better debug logs for sendfile
This commit is contained in:
parent
cdb997215b
commit
518dd4fb8d
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-08-08 19:07+0300\n"
|
||||
"POT-Creation-Date: 2024-08-09 00:35+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -60,8 +60,10 @@ bool lm_mptp_sendfile(int sock, char *path, lm_mptp_transfer_callback_t callback
|
||||
|
||||
while ((read = fread(packet.data, 1, MPTP_DATA_MAX, file)) > 0) {
|
||||
packet.header.data_size = read;
|
||||
if(!lm_mptp_server_send(sock, &packet))
|
||||
if(!lm_mptp_server_send(sock, &packet)){
|
||||
pdebug(__func__, "failed to send packet for %s (left at %lu/%lu): %s", path, current, total, lm_strerror());
|
||||
goto end;
|
||||
}
|
||||
|
||||
current += read;
|
||||
|
||||
@ -79,6 +81,7 @@ bool lm_mptp_sendfile(int sock, char *path, lm_mptp_transfer_callback_t callback
|
||||
goto end;
|
||||
}
|
||||
|
||||
pdebug(__func__, "completed sending %s, sending last packet", path);
|
||||
lm_mptp_init(&packet, false, MPTP_S2C_COOL, true);
|
||||
ret = true;
|
||||
|
||||
@ -86,7 +89,6 @@ end:
|
||||
if(NULL != file)
|
||||
fclose(file);
|
||||
|
||||
pdebug(__func__, "completed sending %s, sending last packet", path);
|
||||
lm_mptp_server_send(sock, &packet);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user