Skip to content

Commit

Permalink
Bugfix: daemon wg sync
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Oct 2, 2014
1 parent 0d84af5 commit 874d612
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/ipfs/init.go
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion daemon/daemon.go
Expand Up @@ -94,15 +94,17 @@ 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()
if err != nil {
if !dl.closed {
log.Warning("DaemonListener Accept: %v", err)
}
dl.lk.Close()
return
}
go dl.handleConnection(conn)
Expand Down

0 comments on commit 874d612

Please sign in to comment.