diff --git a/app/app.go b/app/app.go index 71f0523..f839b8f 100644 --- a/app/app.go +++ b/app/app.go @@ -74,7 +74,6 @@ func (app *application) CreatePeer(name string, password string) (peer.CwtchPeer return nil, err } p.Init(app.acn) - p.Listen() _, exists := app.peers[p.GetProfile().Onion] if exists { p.Shutdown() @@ -126,17 +125,11 @@ func (app *application) LoadProfiles(password string) error { func (app *application) LaunchPeers() { for _, p := range app.peers { if !p.IsStarted() { - app.startPeer(p) + p.Listen() } } } -func (app *application) startPeer(peer peer.CwtchPeer) { - go func() { - peer.Listen() - }() -} - // ListPeers returns a map of onions to their profile's Name func (app *application) ListPeers() map[string]string { keys := map[string]string{} diff --git a/app/cli/main.go b/app/cli/main.go index ecd8bd6..48a5300 100644 --- a/app/cli/main.go +++ b/app/cli/main.go @@ -337,6 +337,7 @@ func main() { fmt.Printf("Error creating profile for %v: Your password entries must match!\n", name) } else { p, err := app.CreatePeer(name, password) + app.LaunchPeers() if err == nil { stopGroupFollow() fmt.Printf("\nNew profile created for %v\n", name) @@ -356,6 +357,7 @@ func main() { err = app.LoadProfiles(string(bytePassword)) if err == nil { + app.LaunchPeers() profiles := app.ListPeers() fmt.Printf("\n%v profiles active now\n", len(profiles)) fmt.Printf("You should run `select-profile` to use a profile or `list-profiles` to view loaded profiles\n")