rhizome direct enquiry request now gets back enquiry response,

and realises that it needs to process it.  It does not yet
process it. #9
This commit is contained in:
gardners 2012-09-11 14:34:58 +09:30
parent 9a5dbbd14f
commit 6553050566
3 changed files with 10 additions and 5 deletions

View File

@ -384,7 +384,7 @@ struct http_response {
unsigned long long content_length; unsigned long long content_length;
const char * body; const char * body;
}; };
int rhizome_server_set_response(rhizome_http_request *r, const struct http_response *h);
int rhizome_server_free_http_request(rhizome_http_request *r); int rhizome_server_free_http_request(rhizome_http_request *r);
int rhizome_server_http_send_bytes(rhizome_http_request *r); int rhizome_server_http_send_bytes(rhizome_http_request *r);
int rhizome_server_parse_http_request(rhizome_http_request *r); int rhizome_server_parse_http_request(rhizome_http_request *r);

View File

@ -260,7 +260,8 @@ rhizome_direct_bundle_cursor *rhizome_direct_get_fill_response
{ {
if (size<10) return NULL; if (size<10) return NULL;
rhizome_direct_bundle_cursor *c=calloc(sizeof(rhizome_direct_bundle_cursor),1); rhizome_direct_bundle_cursor *c=rhizome_direct_bundle_iterator(size);
assert(c!=NULL);
if (rhizome_direct_bundle_iterator_unpickle_range(c,buffer,10)) if (rhizome_direct_bundle_iterator_unpickle_range(c,buffer,10))
{ {
DEBUGF("Couldn't unpickle range"); DEBUGF("Couldn't unpickle range");
@ -270,9 +271,10 @@ rhizome_direct_bundle_cursor *rhizome_direct_get_fill_response
DEBUGF("unpickled size_high=%lld, limit_size_high=%lld", DEBUGF("unpickled size_high=%lld, limit_size_high=%lld",
c->size_high,c->limit_size_high); c->size_high,c->limit_size_high);
rhizome_direct_bundle_iterator_free(&c); int count=rhizome_direct_bundle_iterator_fill(c,-1);
return NULL; DEBUGF("Found %d manifests in that range",count);
return c;
} }

View File

@ -137,7 +137,7 @@ int rhizome_direct_form_received(rhizome_http_request *r)
assert(r->buffer_offset<1024); assert(r->buffer_offset<1024);
/* Now append body and send it back. */ /* Now append body and send it back. */
bcopy(c->buffer,&r->buffer[r->buffer_offset],bytes); bcopy(c->buffer,&r->buffer[r->buffer_length],bytes);
r->buffer_length+=bytes; r->buffer_length+=bytes;
r->buffer_offset=0; r->buffer_offset=0;
@ -673,6 +673,7 @@ void rhizome_direct_http_dispatch(rhizome_direct_sync_request *r)
while(!http_header_complete(buffer,len,len)&&(len<8192)) while(!http_header_complete(buffer,len,len)&&(len<8192))
{ {
int count=read(sock,&buffer[len],8192-len); int count=read(sock,&buffer[len],8192-len);
if (count==0) break;
if (count<1) { if (count<1) {
DEBUGF("errno=%d, count=%d",errno,count); DEBUGF("errno=%d, count=%d",errno,count);
close(sock); close(sock);
@ -734,6 +735,8 @@ void rhizome_direct_http_dispatch(rhizome_direct_sync_request *r)
close(sock); goto end; close(sock); goto end;
} }
DEBUGF("XXX Reading enquiry response for processing");
end: end:
/* Warning: tail recursion when done this way. /* Warning: tail recursion when done this way.
Should be triggered by an asynchronous event. Should be triggered by an asynchronous event.