tWait for the client to close the connection - synk - synchronize files between hosts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit aa9ebd6d6195dad020c1e2ff124a955b62e120b2
 (DIR) parent a1da0e4995ec90f1913f3680543dc0f3c86c524c
 (HTM) Author: z3bra <willyatmailoodotorg>
       Date:   Fri,  9 Sep 2016 13:28:55 +0200
       
       Wait for the client to close the connection
       
       Diffstat:
         M synk.c                              |       4 +++-
       
       1 file changed, 3 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/synk.c b/synk.c
       t@@ -302,6 +302,7 @@ flushpeers(struct peers_t *plist)
        int
        sendmetadata(struct client_t *c)
        {
       +        char buf;
                ssize_t len = 0;
                struct metadata_t *local, remote;
        
       t@@ -316,8 +317,9 @@ sendmetadata(struct client_t *c)
        
                /* .. and send it to the client */
                write(c->fd, local, sizeof(struct metadata_t));
       -        close(c->fd);
        
       +        while (recv(c->fd, &buf, 1, MSG_PEEK) > 0);
       +        close(c->fd);
                free(c);
        
                return -1;