mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
added debug message for when sqlite returns results that it shouldn't.
(FILESIZE BETWEEN X and Y is not behaving correctly -- it sometimes returns results with the out of bounds FILESIZE values). #9
This commit is contained in:
parent
c356ead09c
commit
0d988921ac
@ -256,12 +256,12 @@ int rhizome_direct_conclude_sync_request(rhizome_direct_sync_request *r)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
This function is called with the list of BARs for a specified cursor range
|
This function is called with the list of BARs for a specified cursor range
|
||||||
that the far-end possesses, i.e., what we are given is a list of "I have"'s.
|
that the far-end possesses, i.e., what we are given is a list of the far end's
|
||||||
To produce our reply, we need to work out corresponding list of "I have"'s, and
|
"I have"'s. To produce our reply, we need to work out corresponding list of
|
||||||
then compare them to produce the list of "you have and I want" and "I have and
|
"I have"'s, and then compare them to produce the list of "you have and I want"
|
||||||
you want" that if fulfilled, would result in both ends having the same set of
|
and "I have and you want" that if fulfilled, would result in both ends having the
|
||||||
BARs for the specified cursor range. The potential presense of multiple versions
|
same set of BARs for the specified cursor range. The potential presense of
|
||||||
of a given bundle introduces only a slight complication.
|
multiple versions of a given bundle introduces only a slight complication.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rhizome_direct_bundle_cursor *rhizome_direct_get_fill_response
|
rhizome_direct_bundle_cursor *rhizome_direct_get_fill_response
|
||||||
@ -724,7 +724,7 @@ int rhizome_direct_get_bars(const unsigned char bid_low[RHIZOME_MANIFEST_ID_BYTE
|
|||||||
char query[1024];
|
char query[1024];
|
||||||
|
|
||||||
snprintf(query,1024,
|
snprintf(query,1024,
|
||||||
"SELECT BAR,ROWID,ID FROM MANIFESTS"
|
"SELECT BAR,ROWID,ID,FILESIZE FROM MANIFESTS"
|
||||||
" WHERE ID>='%s' AND ID<='%s' AND FILESIZE BETWEEN %lld AND %lld"
|
" WHERE ID>='%s' AND ID<='%s' AND FILESIZE BETWEEN %lld AND %lld"
|
||||||
" ORDER BY BAR LIMIT %d;",
|
" ORDER BY BAR LIMIT %d;",
|
||||||
alloca_tohex(bid_low,RHIZOME_MANIFEST_ID_BYTES),
|
alloca_tohex(bid_low,RHIZOME_MANIFEST_ID_BYTES),
|
||||||
@ -747,6 +747,12 @@ int rhizome_direct_get_bars(const unsigned char bid_low[RHIZOME_MANIFEST_ID_BYTE
|
|||||||
sqlite3_blob_close(blob);
|
sqlite3_blob_close(blob);
|
||||||
blob = NULL;
|
blob = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
int64_t filesize = sqlite3_column_int64(statement, 3);
|
||||||
|
if (filesize<size_low||filesize>size_high) {
|
||||||
|
DEBUGF("WEIRDNESS ALERT: filesize=%lld, but query was: %s",
|
||||||
|
filesize,query);
|
||||||
|
break;
|
||||||
|
}
|
||||||
int64_t rowid = sqlite3_column_int64(statement, 1);
|
int64_t rowid = sqlite3_column_int64(statement, 1);
|
||||||
do ret = sqlite3_blob_open(rhizome_db, "main", "manifests", "bar",
|
do ret = sqlite3_blob_open(rhizome_db, "main", "manifests", "bar",
|
||||||
rowid, 0 /* read only */, &blob);
|
rowid, 0 /* read only */, &blob);
|
||||||
@ -780,7 +786,7 @@ int rhizome_direct_get_bars(const unsigned char bid_low[RHIZOME_MANIFEST_ID_BYTE
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* non-BLOB field. This is an error, but we will persevere with subsequent
|
/* non-BLOB field. This is an error, but we will persevere with subsequent
|
||||||
rows, becuase they might be fine. */
|
rows, because they might be fine. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user