synk

synchronize files between hosts
Log | Files | Refs | README | LICENSE

commit 6dc505684ce6858d82889b8c487b768daaa3533d
parent 6ea0770423ed8bc445f150d43a6e18beeeb9bb25
Author: Willy <willyatmailoodotorg>
Date:   Tue Sep  6 08:46:01 +0200

Peer localhost data with other peers

Diffstat:
synk.c | 20++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/synk.c b/synk.c @@ -537,9 +537,15 @@ syncfile(struct peers_t *plist, const char *fn) if (!local) return -1; + addpeer(plist, "localhost", 0); SLIST_FOREACH(tmp, plist, entries) { - if (getpeermeta(tmp, local) != 0) - return -1; + if (IS_LOOPBACK(tmp)) { + memcpy(&tmp->meta, local, sizeof(struct metadata_t)); + } else { + if (getpeermeta(tmp, local) != 0) + return -1; + } + log(LOG_VERBOSE, "peer: %s\t%s\t%.7s\t%lu\n", tmp->host, tmp->meta.path, @@ -547,16 +553,6 @@ syncfile(struct peers_t *plist, const char *fn) tmp->meta.mtime); } - addpeer(plist, "localhost", 0); - tmp = SLIST_FIRST(plist); - tmp->meta = *local; - - log(LOG_VERBOSE, "peer: %s\t%s\t%.7s\t%lu\n", - tmp->host, - tmp->meta.path, - sha512_format(tmp->meta.hash), - tmp->meta.mtime); - if (!uptodate(plist)) { master = freshestpeer(plist); ret = syncwithmaster(master, plist);