@cryptotaxi247 / kubo / commits / 874d61270

Bugfix: daemon wg sync

Juan Batiz-Benet committed Oct 2, 2014 at 00:04 UTC 874d61270e92b255b256b7397853b1a41668613b
2 files changed +4 -2
cmd/ipfs/init.go
+1 -1
@@ -2,9 +2,9 @@ package main
2
3 import (
4 "encoding/base64"
5 - "path/filepath"
5 "errors"
6 "os"
7 + "path/filepath"
8
9 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
10 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
daemon/daemon.go
+3 -1
@@ -94,7 +94,10 @@ func (dl *DaemonListener) Listen() {
94 panic("attempting to listen on a closed daemon Listener")
95 }
96
97 + // add ourselves to workgroup. and remove ourselves when done.
98 dl.wg.Add(1)
99 + defer dl.wg.Done()
100 +
101 log.Info("daemon listening")
102 for {
103 conn, err := dl.list.Accept()
@@ -102,7 +105,6 @@ func (dl *DaemonListener) Listen() {
105 if !dl.closed {
106 log.Warning("DaemonListener Accept: %v", err)
107 }
105 - dl.lk.Close()
108 return
109 }
110 go dl.handleConnection(conn)