tAdd function to sync a master peer with a list - synk - synchronize files between hosts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 697a309f1a1667cf47385370c18e3387af07c06d
 (DIR) parent 7e527e7825ec47e18fbba3ebb88ef9910bfa5ec4
 (HTM) Author: Willy <willyatmailoodotorg>
       Date:   Tue, 30 Aug 2016 22:34:41 +0200
       
       Add function to sync a master peer with a list
       
       Diffstat:
         M synk.c                              |      16 ++++++++++++++++
       
       1 file changed, 16 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/synk.c b/synk.c
       t@@ -58,6 +58,7 @@ struct peer_t *freshestpeer(struct peers_t *);
        int syncfile(struct peers_t *, const char *);
        int syncstatus(struct peers_t *);
        int flushpeers(struct peers_t *);
       +int syncwithmaster(struct peer_t *master, struct peers_t *plist);
        
        const char *rsync_cmd[] = { "rsync", "-azEq", "--delete", NULL };
        
       t@@ -321,6 +322,21 @@ freshestpeer(struct peers_t *plist)
                return freshest;
        }
        
       +/*
       + * Logic to synchronize a remote peer with all the slaves if they differ
       + */
       +int
       +syncwithmaster(struct peer_t *master, struct peers_t *plist)
       +{
       +        struct peer_t *slave = NULL;
       +        SLIST_FOREACH(slave, plist, entries) {
       +                if (slave == master)
       +                        continue;
       +                if (!sha512_compare(master->meta.hash, slave->meta.hash))
       +                        continue;
       +
       +                /* SYNC COMMAND */
       +        }
                return 0;
        }