summaryrefslogtreecommitdiff
path: root/src/or/consdiff.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-05-03 15:08:59 -0400
committerNick Mathewson <nickm@torproject.org>2017-05-04 08:37:41 -0400
commitc12d2cb2dcfe52aadf528a70433b468327472eaf (patch)
treec7975f6589f14759d6a2355a076f88351c541181 /src/or/consdiff.c
parent912b0641e9e9922ad2da50973579de38cb4be6ba (diff)
downloadtor-c12d2cb2dcfe52aadf528a70433b468327472eaf.tar.gz
tor-c12d2cb2dcfe52aadf528a70433b468327472eaf.zip
Request (and try to use) consensus diffs.
Diffstat (limited to 'src/or/consdiff.c')
-rw-r--r--src/or/consdiff.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/consdiff.c b/src/or/consdiff.c
index 3c2140b642..1baa11897c 100644
--- a/src/or/consdiff.c
+++ b/src/or/consdiff.c
@@ -1401,3 +1401,12 @@ consensus_diff_apply(const char *consensus,
return result;
}
+/** Return true iff, based on its header, <b>document</b> is likely
+ * to be a consensus diff. */
+int
+looks_like_a_consensus_diff(const char *document, size_t len)
+{
+ return (len >= strlen(ns_diff_version) &&
+ fast_memeq(document, ns_diff_version, strlen(ns_diff_version)));
+}
+