mirror of
https://gitlab.com/comunic/ComunicRTCProxy
synced 2024-12-26 05:28:53 +00:00
Can request to close a connection
This commit is contained in:
parent
d1a79f49ac
commit
d2d2dedf92
12
relay.go
12
relay.go
@ -411,6 +411,18 @@ func newCall(mainOffer receivedSignal, r activeRelay) {
|
|||||||
log.Printf("Err tried to add ICE Candidate for non ready peer connection!")
|
log.Printf("Err tried to add ICE Candidate for non ready peer connection!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if newMessage.sigType == CloseConnection {
|
||||||
|
|
||||||
|
// Check if we have to close the whole connection or just a client
|
||||||
|
if newMessage.peerID == "0" {
|
||||||
|
askForClose(r)
|
||||||
|
return
|
||||||
|
} else if val, ok := clients[newMessage.peerID]; ok {
|
||||||
|
// Close a single client
|
||||||
|
val.Close()
|
||||||
|
delete(clients, newMessage.peerID)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
ws.go
5
ws.go
@ -82,6 +82,11 @@ func openWs(conf *Config) {
|
|||||||
onSignal(msg.CallHash, msg.PeerID, msg.Data.(map[string]interface{}))
|
onSignal(msg.CallHash, msg.PeerID, msg.Data.(map[string]interface{}))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
// Close a connection
|
||||||
|
case "close_conn":
|
||||||
|
onCloseConnection(msg.CallHash, msg.PeerID)
|
||||||
|
break
|
||||||
|
|
||||||
default:
|
default:
|
||||||
println("Received unkown message type!")
|
println("Received unkown message type!")
|
||||||
log.Printf("recv: %s", message)
|
log.Printf("recv: %s", message)
|
||||||
|
Loading…
Reference in New Issue
Block a user