diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-10 03:01:26 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-10 03:01:26 +0000 |
commit | 7aa7d1a3e7f8b39b5c4f036beeb92f23c5d39e5d (patch) | |
tree | e57875edcfbaeca2079dab1a026b2463e2af0c4f /src/or/routerlist.c | |
parent | d7bf7e0b3211c3a47f41fbbd519d56a9958d76d1 (diff) | |
download | tor-7aa7d1a3e7f8b39b5c4f036beeb92f23c5d39e5d.tar.gz tor-7aa7d1a3e7f8b39b5c4f036beeb92f23c5d39e5d.zip |
Give a better error when something has changed our descriptor cache out from under us. Based on patch from Karsten. Addresses bug 885.
svn:r17550
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index e2f3170b6a..5ed8813f9a 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2211,6 +2211,11 @@ signed_descriptor_get_body_impl(signed_descriptor_t *desc, if (store && store->mmap) { tor_assert(desc->saved_offset + len <= store->mmap->size); r = store->mmap->data + offset; + } else if (store) { + log_err(LD_DIR, "We couldn't read a descriptor that is supposedly " + "mmaped in our cache. Is another process running in our data " + "directory? Exiting."); + exit(1); } } if (!r) /* no mmap, or not in cache. */ @@ -2221,11 +2226,11 @@ signed_descriptor_get_body_impl(signed_descriptor_t *desc, if (!with_annotations) { if (memcmp("router ", r, 7) && memcmp("extra-info ", r, 11)) { char *cp = tor_strndup(r, 64); - log_err(LD_DIR, "descriptor at %p begins with unexpected string %s", + log_err(LD_DIR, "descriptor at %p begins with unexpected string %s. " + "Is another process running in our data directory? Exiting.", desc, escaped(cp)); - tor_free(cp); + exit(1); } - tor_assert(!memcmp("router ", r, 7) || !memcmp("extra-info ", r, 11)); } return r; |