1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Better protection against duplicate connection ids.

This commit is contained in:
Juliusz Chroboczek 2020-05-22 22:38:40 +02:00
parent 6005ad9eb4
commit 57163c70a3

View file

@ -320,7 +320,7 @@ func addUpConn(c *client, id string) (*upConnection, error) {
if c.up == nil {
c.up = make(map[string]*upConnection)
}
if c.up[id] != nil {
if c.up[id] != nil || (c.down != nil && c.down[id] != nil) {
conn.pc.Close()
return nil, errors.New("Adding duplicate connection")
}
@ -697,7 +697,7 @@ func addDownConn(c *client, id string, remote *upConnection) (*downConnection, e
c.mu.Lock()
defer c.mu.Unlock()
if c.down[id] != nil {
if c.down[id] != nil || (c.up != nil && c.up[id] != nil) {
conn.pc.Close()
return nil, errors.New("Adding duplicate connection")
}