mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Restart downstream connections on ICE failure.
This commit is contained in:
parent
dbd87895ba
commit
23cceba7ba
1 changed files with 18 additions and 9 deletions
27
webclient.go
27
webclient.go
|
@ -335,6 +335,12 @@ func addDownConn(c *webClient, id string, remote upConnection) (*rtpDownConnecti
|
||||||
sendICE(c, id, candidate)
|
sendICE(c, id, candidate)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
conn.pc.OnICEConnectionStateChange(func(state webrtc.ICEConnectionState) {
|
||||||
|
if state == webrtc.ICEConnectionStateFailed {
|
||||||
|
c.action(connectionFailedAction{id: id})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
err = remote.addLocal(conn)
|
err = remote.addLocal(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.pc.Close()
|
conn.pc.Close()
|
||||||
|
@ -779,17 +785,20 @@ func clientLoop(c *webClient, conn *websocket.Conn) error {
|
||||||
go a.c.pushConn(u.id, u, ts, u.label)
|
go a.c.pushConn(u.id, u, ts, u.label)
|
||||||
}
|
}
|
||||||
case connectionFailedAction:
|
case connectionFailedAction:
|
||||||
found := delUpConn(c, a.id)
|
down := getDownConn(c, a.id);
|
||||||
if found {
|
if down == nil {
|
||||||
err := failConnection(c, a.id,
|
log.Printf("Failed indication for " +
|
||||||
"connection failed")
|
"unknown connection")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// What should we do if a downstream
|
tracks := make([]upTrack, len(down.tracks))
|
||||||
// connection fails? Renegotiate?
|
for i, t := range down.tracks {
|
||||||
|
tracks[i] = t.remote
|
||||||
|
}
|
||||||
|
go c.pushConn(
|
||||||
|
down.remote.Id(), down.remote,
|
||||||
|
tracks, down.remote.Label(),
|
||||||
|
)
|
||||||
case permissionsChangedAction:
|
case permissionsChangedAction:
|
||||||
c.write(clientMessage{
|
c.write(clientMessage{
|
||||||
Type: "permissions",
|
Type: "permissions",
|
||||||
|
|
Loading…
Reference in a new issue