diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index c894bdd..70646a0 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -93,6 +93,7 @@ type CwtchPeer interface { Listen() StartPeersConnections() + StartServerConnections() Shutdown() } @@ -480,13 +481,20 @@ func (cp *cwtchPeer) Listen() { cp.eventBus.Publish(event.NewEvent(event.ProtocolEngineStartListen, map[event.Field]string{event.Onion: cp.Profile.Onion})) } -// StartGroupConnections attempts to connect to all group servers (thus initiating reconnect attempts in the conectionsmanager) +// StartPeersConnections attempts to connect to peer connections func (cp *cwtchPeer) StartPeersConnections() { + for _, contact := range cp.GetContacts() { + if cp.GetContact(contact).IsServer() == false { + cp.PeerWithOnion(contact) + } + } +} + +// StartServerConnections attempts to connect to all server connections +func (cp *cwtchPeer) StartServerConnections() { for _, contact := range cp.GetContacts() { if cp.GetContact(contact).IsServer() { cp.JoinServer(contact) - } else { - cp.PeerWithOnion(contact) } } } diff --git a/testing/cwtch_peer_server_integration_test.go b/testing/cwtch_peer_server_integration_test.go index 300bb87..b1e7b50 100644 --- a/testing/cwtch_peer_server_integration_test.go +++ b/testing/cwtch_peer_server_integration_test.go @@ -118,14 +118,14 @@ func TestCwtchPeerIntegration(t *testing.T) { log.ExcludeFromPattern("event/eventmanager") log.ExcludeFromPattern("pipeBridge") log.ExcludeFromPattern("tapir") - os.Mkdir("tordir",0700) + os.Mkdir("tordir", 0700) dataDir := path.Join("tordir", "tor") os.MkdirAll(dataDir, 0700) // we don't need real randomness for the port, just to avoid a possible conflict... mrand.Seed(int64(time.Now().Nanosecond())) - socksPort := mrand.Intn(1000)+9051 - controlPort := mrand.Intn(1000)+9052 + socksPort := mrand.Intn(1000) + 9051 + controlPort := mrand.Intn(1000) + 9052 // generate a random password key := make([]byte, 64) @@ -139,7 +139,7 @@ func TestCwtchPeerIntegration(t *testing.T) { if err != nil { t.Fatalf("Could not start Tor: %v", err) } - pid,err := acn.GetPID() + pid, err := acn.GetPID() t.Logf("Tor pid: %v", pid) // ***** Cwtch Server management *****