mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-06 11:09:13 +00:00
Add some helpful debug logging
This commit is contained in:
parent
43c7297a47
commit
c847478140
@ -154,6 +154,13 @@ int rhizome_add_manifest(rhizome_manifest *m_in,
|
|||||||
const char *author // NULL or zero-length to make an unauthored manifest
|
const char *author // NULL or zero-length to make an unauthored manifest
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (debug&DEBUG_RHIZOMESYNC)
|
||||||
|
DEBUGF("rhizome_add_manifest(m_in=%p, m_out=%p, filename=%s, groups=%p, ttl=%d, verifyP=%d, checkFileP=%d, signP=%d, author=%s)",
|
||||||
|
m_in, m_out,
|
||||||
|
filename ? filename : "NULL",
|
||||||
|
groups, ttl, verifyP, checkFileP, signP,
|
||||||
|
author ? author : "NULL"
|
||||||
|
);
|
||||||
if (m_out) *m_out = NULL;
|
if (m_out) *m_out = NULL;
|
||||||
if (author && !author[0]) author = NULL;
|
if (author && !author[0]) author = NULL;
|
||||||
|
|
||||||
@ -200,6 +207,8 @@ int rhizome_add_manifest(rhizome_manifest *m_in,
|
|||||||
if (lstat(filename,&stat))
|
if (lstat(filename,&stat))
|
||||||
return WHYF("Could not stat() payload file '%s'",filename);
|
return WHYF("Could not stat() payload file '%s'",filename);
|
||||||
m_in->fileLength = stat.st_size;
|
m_in->fileLength = stat.st_size;
|
||||||
|
if (debug & DEBUG_RHIZOME)
|
||||||
|
DEBUGF("filename=%s, fileLength=%lld", filename, m_in->fileLength);
|
||||||
long long mfilesize = rhizome_manifest_get_ll(m_in, "filesize");
|
long long mfilesize = rhizome_manifest_get_ll(m_in, "filesize");
|
||||||
if (mfilesize != -1 && mfilesize != m_in->fileLength) {
|
if (mfilesize != -1 && mfilesize != m_in->fileLength) {
|
||||||
WHYF("Manifest.filesize (%lld) != actual file size (%lld)", mfilesize, m_in->fileLength);
|
WHYF("Manifest.filesize (%lld) != actual file size (%lld)", mfilesize, m_in->fileLength);
|
||||||
|
@ -612,17 +612,17 @@ int rhizome_queue_manifest_import(rhizome_manifest *m, struct sockaddr_in *peeri
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
q->manifest->dataFileName = strdup(filename);
|
q->manifest->dataFileName = strdup(filename);
|
||||||
q->file=fopen(filename,"w");
|
q->file=fopen(q->manifest->dataFileName,"w");
|
||||||
if (!q->file) {
|
if (!q->file) {
|
||||||
WHY_perror("fopen");
|
WHY_perror("fopen");
|
||||||
if (debug&DEBUG_RHIZOME)
|
if (debug&DEBUG_RHIZOME)
|
||||||
DEBUGF("Could not open '%s' to write received file.", filename);
|
DEBUGF("Could not open '%s' to write received file.", q->manifest->dataFileName);
|
||||||
close(sock);
|
close(sock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
rhizome_file_fetch_queue_count++;
|
rhizome_file_fetch_queue_count++;
|
||||||
if (debug&DEBUG_RHIZOME) DEBUGF("Queued file for fetching (%d in queue)",
|
if (debug&DEBUG_RHIZOME) DEBUGF("Queued file for fetching into %s (%d in queue)",
|
||||||
rhizome_file_fetch_queue_count);
|
q->manifest->dataFileName, rhizome_file_fetch_queue_count);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user