cleaned up some debug output, among other things.

This commit is contained in:
gardners 2012-05-22 17:04:24 +09:30
parent 3f1f668e8b
commit 6a83f2434f
4 changed files with 25 additions and 21 deletions

View File

@ -196,7 +196,7 @@ int monitor_poll()
#endif
!= -1
) {
WHYF("ignored_length=%d",ignored_length);
if (0) WHYF("ignored_length=%d",ignored_length);
int res = fcntl(s,F_SETFL, O_NONBLOCK);
if (res) { close(s); continue; }
#if defined(HAVE_LINUX_STRUCT_UCRED)
@ -221,8 +221,8 @@ int monitor_poll()
otheruid = ucred.cr_uid;
#endif
if (otheruid&&(otheruid!=getuid())) {
WHYF("monitor.socket client has wrong uid (%d versus %d)",
otheruid,getuid());
if (0) WHYF("monitor.socket client has wrong uid (%d versus %d)",
otheruid,getuid());
write(s,"\nCLOSE:Incorrect UID\n",strlen("\nCLOSE:Incorrect UID\n"));
close(s); continue;
}

View File

@ -321,16 +321,11 @@ int rhizome_add_manifest(rhizome_manifest *m_in,
rhizome_manifest_add_group(m_in, groups[i]);
}
WHYF("bytes=%d, all_bytes=%d",m_in->manifest_bytes,m_in->manifest_all_bytes);
dump("importing manifest",m_in->manifestdata,m_in->manifest_all_bytes);
/* Finish completing the manifest */
if (m_in->finalised==0)
if (rhizome_manifest_finalise(m_in, signP, author))
return WHY("Failed to finalise manifest.\n");
dump("between finalise and store",m_in->manifestdata,m_in->manifest_all_bytes);
/* Okay, it is written, and can be put directly into the rhizome database now */
if (rhizome_store_bundle(m_in, filename) == -1)
return WHY("rhizome_store_bundle() failed.");

View File

@ -355,7 +355,7 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m,
int i;
if (0) WHYF("Rhizome considering %s (size=%lld, priority=%d)",
id,filesize,priority);
id,filesize,priority);
if (rhizome_manifest_version_cache_lookup(m)) {
/* We already have this version or newer */
@ -426,8 +426,8 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m,
} else candidate_count++;
/* shuffle down */
int bytes=(candidate_count-(i+1))*sizeof(rhizome_candidates);
WHYF("Moving slot %d to slot %d (%d bytes = %d slots)",
i,i+1,bytes,bytes/sizeof(rhizome_candidates));
if (0) WHYF("Moving slot %d to slot %d (%d bytes = %d slots)",
i,i+1,bytes,bytes/sizeof(rhizome_candidates));
bcopy(&candidates[i],
&candidates[i+1],
bytes);
@ -438,12 +438,14 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m,
candidates[i].peer=*peerip;
int j;
WHY("Rhizome priorities fetch list now:");
for(j=0;j<candidate_count;j++)
WHYF("%02d:%s:size=%lld, priority=%d",
j,
rhizome_manifest_get(candidates[j].manifest,"id",NULL,0),
candidates[j].size,candidates[j].priority);
if (0) {
WHY("Rhizome priorities fetch list now:");
for(j=0;j<candidate_count;j++)
WHYF("%02d:%s:size=%lld, priority=%d",
j,
rhizome_manifest_get(candidates[j].manifest,"id",NULL,0),
candidates[j].size,candidates[j].priority);
}
return 0;
}
@ -818,8 +820,12 @@ int rhizome_fetch_poll()
q->manifest->manifest_all_bytes);
}
q->manifest->finalised=1;
WHYF("finalised=%d",q->manifest->finalised);
q->manifest->manifest_bytes=q->manifest->manifest_all_bytes;
if (!rhizome_write_manifest_file(q->manifest,filename)) {
WHYF("finalised=%d",q->manifest->finalised);
q->manifest->finalised=1;
WHYF("finalised=%d",q->manifest->finalised);
rhizome_bundle_import(q->manifest, NULL, id,
NULL /* no additional groups */,
q->manifest->ttl - 1 /* TTL */,

View File

@ -165,7 +165,7 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e)
snprintf(query,1024,"SELECT BAR,ROWID FROM MANIFESTS LIMIT %d,%d",
bundle_offset[pass],slots);
break;
}
}
switch (sqlite3_prepare_v2(rhizome_db,query,-1,&statement,NULL))
{
@ -305,9 +305,9 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e)
int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now)
{
if (!f) return -1;
if (0&&debug&DEBUG_RHIZOME) {
if (debug&DEBUG_RHIZOME) {
WHYF("rhizome f->bytecount=%d",f->payload->length);
dump("payload",f->payload->bytes,f->payload->length);
// dump("payload",f->payload->bytes,f->payload->length);
}
int ofs=0;
@ -344,6 +344,9 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now)
if (rhizome_ignore_manifest_check(m,(struct sockaddr_in *)f->recvaddr))
{
/* Ignoring manifest that has caused us problems recently */
WHYF("Ignoring manifest with errors: %s",
rhizome_manifest_get(m,"id",NULL,0)
);
}
else if (m&&(!m->errors))
{
@ -352,7 +355,7 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now)
/* We already have this version or newer */
if (debug&DEBUG_RHIZOMESYNC) {
WHYF("manifest id=%s, version=%lld",
rhizome_manifest_get(m,"id",NULL,0),
rhizome_manifest_get(m,"id",NULL,0),
rhizome_manifest_get_ll(m,"version"));
WHY("We already have that manifest or newer.");
}