debug fiddles etc.

This commit is contained in:
gardners 2012-05-22 11:45:54 +09:30
parent 4d5627a732
commit fd343ca5b0
2 changed files with 14 additions and 4 deletions

View File

@ -456,7 +456,7 @@ int rhizome_fetch_poll()
{
int rn;
if (debug&DEBUG_RHIZOME) WHYF("Checking %d active fetch requests",
rhizome_file_fetch_queue_count);
rhizome_file_fetch_queue_count);
for(rn=0;rn<rhizome_file_fetch_queue_count;rn++)
{
rhizome_file_fetch_record *q=&file_fetch_queue[rn];
@ -469,6 +469,8 @@ int rhizome_fetch_poll()
switch(q->state)
{
case RHIZOME_FETCH_SENDINGHTTPREQUEST:
WHYF("sending http request (%d of %d bytes sent)",
q->request_ofs,q->request_len);
bytes=write(q->socket,&q->request[q->request_ofs],
q->request_len-q->request_ofs);
if (bytes>0) {
@ -484,13 +486,16 @@ int rhizome_fetch_poll()
q->request_len=0; q->request_ofs=0;
q->state=RHIZOME_FETCH_RXHTTPHEADERS;
}
} else if (errno!=EAGAIN) {
WHY("Got error while sending HTTP request. Closing.");
q->close=1;
}
break;
case RHIZOME_FETCH_RXFILE:
/* Keep reading until we have the promised amount of data */
if (debug&DEBUG_RHIZOME)
WHYF("receiving rhizome fetch file body (current offset=%d)\n",
q->file_ofs);
WHYF("receiving rhizome fetch file body (current offset=%d of %d)\n",
q->file_ofs,q->file_len);
sigPipeFlag=0;
@ -516,7 +521,11 @@ int rhizome_fetch_poll()
continue;
}
q->file_ofs+=bytes;
}
} else if (bytes==0) {
WHY("Got zero bytes, assume socket dead.");
q->close=1;
continue;
}
if (q->file_ofs>=q->file_len)
{
/* got all of file */

View File

@ -352,6 +352,7 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now)
else
{
if (debug&DEBUG_RHIZOME) WHY("Unverified manifest has errors - so not processing any further.");
rhizome_ignore_bundle(m);
}
if (m) rhizome_manifest_free(m);
m=NULL;