fixed signed/unsigned comparison bug in rhizome manifest cache lookup

that was probably stopping some manifest retrievals for meshms.
debugging tweaks.
This commit is contained in:
gardners 2012-05-28 05:29:38 +02:00
parent 0cccb5bf83
commit b31817f564
2 changed files with 8 additions and 4 deletions

View File

@ -51,6 +51,7 @@ SERVALD_SRC_FILES = \
serval-dna/audio_reflector.c serval-dna/audio_reflector.c
SERVALD_LOCAL_CFLAGS = \ SERVALD_LOCAL_CFLAGS = \
-g \
-DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \ -DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" \ -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" \
-DHAVE_LIBC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ -DHAVE_LIBC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \

View File

@ -175,24 +175,27 @@ int rhizome_manifest_version_cache_lookup(rhizome_manifest *m)
} }
if (i==24) { if (i==24) {
/* Entries match -- so check version */ /* Entries match -- so check version */
unsigned long long rev = rhizome_manifest_get_ll(m,"version"); long long rev = rhizome_manifest_get_ll(m,"version");
if (0) WHYF("cached version %lld vs manifest version %lld", if (1) WHYF("cached version %lld vs manifest version %lld",
entry->version,rev); entry->version,rev);
if (rev>entry->version) { if (rev>entry->version) {
/* If we only have an old version, try refreshing the cache /* If we only have an old version, try refreshing the cache
by querying the database */ by querying the database */
entry->version = sqlite_exec_int64("select version from manifests where id='%s'", id); entry->version = sqlite_exec_int64("select version from manifests where id='%s'", id);
WHYF("Refreshed stored version from database: entry->version=%lld",
entry->version);
} }
if (rev<entry->version) { if (rev<entry->version) {
/* the presented manifest is older than we have. /* the presented manifest is older than we have.
This allows the caller to know that they can tell whoever gave them the This allows the caller to know that they can tell whoever gave them the
manifest it's time to get with the times. May or not ever be manifest it's time to get with the times. May or not ever be
implemented, but it would be nice. XXX */ implemented, but it would be nice. XXX */
WHY("cached version is NEWER than presented version"); WHYF("cached version is NEWER than presented version (%lld is newer than %lld)",
entry->version,rev);
return -2; return -2;
} else if (rev<=entry->version) { } else if (rev<=entry->version) {
/* the presented manifest is already stored. */ /* the presented manifest is already stored. */
if (0) WHY("cached version is NEWER/SAME as presented version"); if (1) WHY("cached version is NEWER/SAME as presented version");
return -1; return -1;
} else { } else {
/* the presented manifest is newer than we have */ /* the presented manifest is newer than we have */