fix: TCP network issues

This commit is contained in:
ngn
2024-08-08 02:30:51 +03:00
parent d7dd578fc4
commit 65a9d7610b
14 changed files with 139 additions and 49 deletions

View File

@ -85,6 +85,8 @@ bool lm_mptp_sendfile(int sock, char *path, lm_mptp_transfer_callback_t callback
end:
if(NULL != file)
fclose(file);
pdebug(__func__, "completed sending %s, sending last packet", path);
lm_mptp_server_send(sock, &packet);
return ret;
}
@ -157,7 +159,10 @@ bool lm_mptp_recvfile(int sock, char *path, lm_mptp_transfer_callback_t callback
}
if(current != total){
pdebug(__func__, "failed to receive the entire file (left at %lu/%lu): %s (%s)", current, total, path, lm_strerror());
if(MPTP_IS_LAST(&packet))
pdebug(__func__, "failed to receive the entire file (left at %lu/%lu), got the last packet: %s", current, total, path);
else
pdebug(__func__, "failed to receive the entire file (left at %lu/%lu): %s (%s)", current, total, path, lm_strerror());
lm_error_set(LM_ERR_RecvNotCompleted);
goto end;
}