From f528110257692f04e2e6c9dfadaf9f4f09edeb91 Mon Sep 17 00:00:00 2001 From: gardners Date: Tue, 22 May 2012 15:36:21 +0930 Subject: [PATCH] almost have priority pre-listing of bundles for rhizome working. --- rhizome.h | 3 +++ rhizome_fetch.c | 40 +++++++++++++++++++++++----------------- rhizome_packetformats.c | 1 + 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/rhizome.h b/rhizome.h index b07ac4f4..3cde89dc 100644 --- a/rhizome.h +++ b/rhizome.h @@ -259,3 +259,6 @@ int rhizome_ignore_manifest_check(rhizome_manifest *m, */ #define MAX_RHIZOME_MANIFESTS 24 #define MAX_CANDIDATES 16 + +int rhizome_suggest_queue_manifest_import(rhizome_manifest *m, + struct sockaddr_in *peerip); diff --git a/rhizome_fetch.c b/rhizome_fetch.c index 10ced991..9d5dc2eb 100644 --- a/rhizome_fetch.c +++ b/rhizome_fetch.c @@ -348,10 +348,17 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m, struct sockaddr_in *peerip) { /* must free manifest when done with it */ + char *id=rhizome_manifest_get(m,"id",NULL,0); + long long filesize=rhizome_manifest_get_ll(m,"filesize"); + int priority=100; /* normal priority */ + int i; + + WHYF("Rhizome considering %s (size=%lld, priority=%d)", + id,filesize,priority); if (rhizome_manifest_version_cache_lookup(m)) { /* We already have this version or newer */ - if (debug&DEBUG_RHIZOMESYNC) { + if (1||debug&DEBUG_RHIZOMESYNC) { WHYF("manifest id=%s, version=%lld\n", rhizome_manifest_get(m,"id",NULL,0), rhizome_manifest_get_ll(m,"version")); @@ -360,17 +367,13 @@ int rhizome_suggest_queue_manifest_import(rhizome_manifest *m, rhizome_manifest_free(m); return -1; } else { - if (debug&DEBUG_RHIZOMESYNC) { + if (1||debug&DEBUG_RHIZOMESYNC) { WHYF("manifest id=%s, version=%lld is new to us.\n", rhizome_manifest_get(m,"id",NULL,0), rhizome_manifest_get_ll(m,"version")); } } - char *id=rhizome_manifest_get(m,"id",NULL,0); - long long filesize=rhizome_manifest_get_ll(m,"filesize"); - int priority=100; /* normal priority */ - int i; /* work out where to put it in the list */ for(i=0;icryptoSignPublic,8), - candidates[i].size,candidates[i].priority); + WHYF("%02d:%s:size=%lld, priority=%d", + j, + rhizome_manifest_get(candidates[j].manifest,"id",NULL,0), + candidates[j].size,candidates[j].priority); return 0; } diff --git a/rhizome_packetformats.c b/rhizome_packetformats.c index 58ac74df..62f9f234 100644 --- a/rhizome_packetformats.c +++ b/rhizome_packetformats.c @@ -393,6 +393,7 @@ int overlay_rhizome_saw_advertisements(int i,overlay_frame *f, long long now) /* Add manifest to import queue. We need to know originating IPv4 address so that we can transfer by HTTP. */ + WHY("Suggesting fetching of a bundle"); rhizome_suggest_queue_manifest_import (m,(struct sockaddr_in *)f->recvaddr); }