update: add more callbacks for sendfile and recvfile

This commit is contained in:
ngn 2024-07-16 19:57:55 +03:00
parent afa81c7284
commit 1e9b494c68
2 changed files with 9 additions and 1 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-16 19:29+0300\n"
"POT-Creation-Date: 2024-07-16 19:57+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"

View File

@ -51,6 +51,10 @@ bool lm_mptp_sendfile(int sock, struct sockaddr *addr, char *path, lm_mptp_trans
packet.header.data_size = size;
lm_mptp_server_send(sock, &packet, addr);
if(NULL != callback)
if(!callback(path, current, total, data))
goto end;
// clear the packet
lm_mptp_init(&packet, false, MPTP_S2C_COOL, false);
@ -123,6 +127,10 @@ bool lm_mptp_recvfile(int sock, char *path, lm_mptp_transfer_callback_t callback
lm_error_set(LM_ERR_RecvBadSize);
goto end;
}
if(NULL != callback)
if(!callback(path, current, total, data))
goto end;
while(lm_mptp_client_recv(sock, &packet)){
if(!lm_mptp_client_verify(&packet))