diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index f007972ba..b868f2b91 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -2,9 +2,9 @@ package main import ( "encoding/base64" - "path/filepath" "errors" "os" + "path/filepath" "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag" "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander" diff --git a/daemon/daemon.go b/daemon/daemon.go index 2e4681592..8ec84d848 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -94,7 +94,10 @@ func (dl *DaemonListener) Listen() { panic("attempting to listen on a closed daemon Listener") } + // add ourselves to workgroup. and remove ourselves when done. dl.wg.Add(1) + defer dl.wg.Done() + log.Info("daemon listening") for { conn, err := dl.list.Accept() @@ -102,7 +105,6 @@ func (dl *DaemonListener) Listen() { if !dl.closed { log.Warning("DaemonListener Accept: %v", err) } - dl.lk.Close() return } go dl.handleConnection(conn)