drop startPeer

This commit is contained in:
Dan Ballard 2018-11-26 14:06:26 -08:00
parent 1b8700c677
commit 3cfbb88a58
2 changed files with 3 additions and 8 deletions

View File

@ -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{}

View File

@ -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")