mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-24 15:26:43 +00:00
fixed cursor range reporting bugs. #9
This commit is contained in:
parent
27fc7a44d0
commit
f0c4bfd7bf
@ -652,7 +652,7 @@ int rhizome_direct_bundle_iterator_pickle_range(rhizome_direct_bundle_cursor *r,
|
|||||||
ranges, which will happen with every rhizome direct sync.
|
ranges, which will happen with every rhizome direct sync.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int v;
|
long long v;
|
||||||
int ltwov=0;
|
int ltwov=0;
|
||||||
|
|
||||||
v=r->start_size_high;
|
v=r->start_size_high;
|
||||||
@ -660,6 +660,7 @@ int rhizome_direct_bundle_iterator_pickle_range(rhizome_direct_bundle_cursor *r,
|
|||||||
pickled[0]=ltwov;
|
pickled[0]=ltwov;
|
||||||
for(v=0;v<4;v++) pickled[1+v]=r->start_bid_low[v];
|
for(v=0;v<4;v++) pickled[1+v]=r->start_bid_low[v];
|
||||||
v=r->size_high;
|
v=r->size_high;
|
||||||
|
DEBUGF("pickling size_high=%lld",r->size_high);
|
||||||
while(v) { ltwov++; v=v>>1; }
|
while(v) { ltwov++; v=v>>1; }
|
||||||
pickled[1+4]=ltwov;
|
pickled[1+4]=ltwov;
|
||||||
for(v=0;v<4;v++) pickled[1+4+1+v]=r->bid_high[v];
|
for(v=0;v<4;v++) pickled[1+4+1+v]=r->bid_high[v];
|
||||||
@ -723,6 +724,8 @@ int rhizome_direct_bundle_iterator_fill(rhizome_direct_bundle_cursor *c,int max_
|
|||||||
=(c->buffer_size-c->buffer_used-c->buffer_offset_bytes)/RHIZOME_BAR_BYTES;
|
=(c->buffer_size-c->buffer_used-c->buffer_offset_bytes)/RHIZOME_BAR_BYTES;
|
||||||
if (stuffable<=0) break;
|
if (stuffable<=0) break;
|
||||||
|
|
||||||
|
DEBUGF("size_high=%lld",c->size_high);
|
||||||
|
|
||||||
/* Make sure we only get the range of BIDs allowed by the cursor limit.
|
/* Make sure we only get the range of BIDs allowed by the cursor limit.
|
||||||
If we are not yet at the bundle data size limit, then any bundle is okay.
|
If we are not yet at the bundle data size limit, then any bundle is okay.
|
||||||
If we are at the bundle data size limit, then we need to honour
|
If we are at the bundle data size limit, then we need to honour
|
||||||
@ -745,6 +748,8 @@ int rhizome_direct_bundle_iterator_fill(rhizome_direct_bundle_cursor *c,int max_
|
|||||||
/* no more matches in this size bin, so move up a size bin */
|
/* no more matches in this size bin, so move up a size bin */
|
||||||
c->size_low=c->size_high+1;
|
c->size_low=c->size_high+1;
|
||||||
c->size_high*=2;
|
c->size_high*=2;
|
||||||
|
/* Record that we covered to the end of that size bin */
|
||||||
|
memset(c->bid_high,0xff,RHIZOME_MANIFEST_ID_BYTES);
|
||||||
} else {
|
} else {
|
||||||
/* Continue from next BID */
|
/* Continue from next BID */
|
||||||
bcopy(c->bid_high,c->bid_low,RHIZOME_MANIFEST_ID_BYTES);
|
bcopy(c->bid_high,c->bid_low,RHIZOME_MANIFEST_ID_BYTES);
|
||||||
|
Loading…
Reference in New Issue
Block a user