Split Peer and Server Connection Launching
the build was successful Details

This commit is contained in:
Sarah Jamie Lewis 2020-10-29 14:22:33 -07:00
parent 21c41f24ee
commit 80c6bcead7
2 changed files with 15 additions and 7 deletions

View File

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