mirror of
https://gitlab.com/comunic/ComunicRTCProxy
synced 2024-12-25 13:08:54 +00:00
Ensure all clients connection automatically close
This commit is contained in:
parent
b117cd31d0
commit
1e29c62378
5
relay.go
5
relay.go
@ -157,7 +157,6 @@ func onCloseConnection(callHash, peerID string) {
|
||||
|
||||
/// Close a connection
|
||||
func closeConnection(r *activeRelay) {
|
||||
log.Printf("Closing call %s / id: %d", r.callHash, r.id)
|
||||
|
||||
// Close the channel
|
||||
if !r.closed {
|
||||
@ -169,6 +168,8 @@ func closeConnection(r *activeRelay) {
|
||||
if val, ok := connections[r.callHash]; ok && val.id == r.id {
|
||||
delete(connections, r.callHash)
|
||||
}
|
||||
|
||||
log.Printf("Closing call %s / id: %d (%d remaining open calls)", r.callHash, r.id, len(connections))
|
||||
}
|
||||
|
||||
// Ask for a channel to be closed
|
||||
@ -438,6 +439,8 @@ func newCall(mainOffer receivedSignal, r *activeRelay) {
|
||||
}
|
||||
clients[newMessage.peerID] = newPeerConnection
|
||||
|
||||
defer newPeerConnection.Close()
|
||||
|
||||
// Send ice candidates
|
||||
newPeerConnection.OnICECandidate(func(c *webrtc.ICECandidate) {
|
||||
if c == nil || r.closed {
|
||||
|
Loading…
Reference in New Issue
Block a user