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