|
@@ -156,8 +156,8 @@ func runThrough(i *INode, ch chan int64, report chan statusReport, content []str
|
|
|
}
|
|
|
|
|
|
func (i *INode) walkDir(reportUp chan statusReport) {
|
|
|
- ch := make(chan int64)
|
|
|
- report := make(chan statusReport)
|
|
|
+ ch := make(chan int64, 1)
|
|
|
+ report := make(chan statusReport, 1)
|
|
|
content, err := ls(i.Path)
|
|
|
if err != nil {
|
|
|
Console.Fatal(err)
|
|
@@ -168,10 +168,14 @@ func (i *INode) walkDir(reportUp chan statusReport) {
|
|
|
case size := <-ch:
|
|
|
i.Size += size
|
|
|
case status := <-report:
|
|
|
+ Console.Debugf("[%s] Report from: %s\n", i.Path, status.path)
|
|
|
if status.err != nil {
|
|
|
+ Console.Debugln("Sending error. Path:", status.path, "- Err:", status.err)
|
|
|
reportUp <- status
|
|
|
}
|
|
|
- if status.path == i.Path {
|
|
|
+ if status.err == nil {
|
|
|
+ Console.Debugf("[%s] Received -> %s - Closing channel...\n",
|
|
|
+ i.Path, status.path)
|
|
|
reportUp <- status
|
|
|
close(reportUp)
|
|
|
return
|
|
@@ -187,7 +191,7 @@ func (i *INode) Sizer() {
|
|
|
return
|
|
|
}
|
|
|
report := make(chan statusReport)
|
|
|
- i.walkDir(report)
|
|
|
+ go i.walkDir(report)
|
|
|
for r := range report {
|
|
|
if r.err != nil {
|
|
|
Console.Fatalf("%s: %s", r.path, r.err)
|