Browse Source

Merge branch 'joindisonnect' of dan/cwtch into master

pull/218/head
Sarah Jamie Lewis Gogs 1 year ago
parent
commit
de32784286
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      protocol/connections/connectionsmanager.go

+ 10
- 6
protocol/connections/connectionsmanager.go View File

@@ -45,13 +45,17 @@ func (m *Manager) ManagePeerConnection(host string, engine *Engine) *PeerPeerCon
func (m *Manager) ManageServerConnection(host string, handler func(string, *protocol.GroupMessage)) {
m.lock.Lock()

_, exists := m.serverConnections[host]
if !exists {
psc := NewPeerServerConnection(m.acn, host)
go psc.Run()
psc.GroupMessageHandler = handler
m.serverConnections[host] = psc
psc, exists := m.serverConnections[host]

newPsc := NewPeerServerConnection(m.acn, host)
newPsc.GroupMessageHandler = handler
go newPsc.Run()
m.serverConnections[host] = newPsc

if exists {
psc.Close()
}

m.lock.Unlock()
}



Loading…
Cancel
Save