Handle errors while hashing better.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 3 Jun 2006 20:09:41 +0000 (20:09 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 3 Jun 2006 20:09:41 +0000 (20:09 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@641 959494ce-11ee-0310-bf91-de5d638817bd

daemon/client.c

index f173121..50da10d 100644 (file)
@@ -539,13 +539,10 @@ static void checkhashes(void)
     char *path;
     
     node = shareroot->child;
-    while(1)
+    for(node = shareroot->child; node != NULL; node = nextscnode(node))
     {
-       if(node->child != NULL)
-       {
-           node = node->child;
+       if(node->f.b.type != FILE_REG)
            continue;
-       }
        if(!node->f.b.hastth)
        {
            if((hc = findhashcache(node->dev, node->inode)) != NULL)
@@ -559,19 +556,14 @@ static void checkhashes(void)
                {
                    flog(LOG_WARNING, "could not hash %s, unsharing it", path);
                    freecache(node);
+                   free(path);
+                   flog(LOG_INFO, "sharing %lli bytes", sharesize);
+                   continue;
                }
                free(path);
                return;
            }
        }
-       while(node->next == NULL)
-       {
-           if((node = node->parent) == shareroot)
-               break;
-       }
-       if(node == shareroot)
-           break;
-       node = node->next;
     }
 }