mirror of
https://github.com/jech/galene.git
synced 2024-11-12 19:55:59 +01:00
Better protection against duplicate connection ids.
This commit is contained in:
parent
6005ad9eb4
commit
57163c70a3
1 changed files with 2 additions and 2 deletions
|
@ -320,7 +320,7 @@ func addUpConn(c *client, id string) (*upConnection, error) {
|
||||||
if c.up == nil {
|
if c.up == nil {
|
||||||
c.up = make(map[string]*upConnection)
|
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()
|
conn.pc.Close()
|
||||||
return nil, errors.New("Adding duplicate connection")
|
return nil, errors.New("Adding duplicate connection")
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ func addDownConn(c *client, id string, remote *upConnection) (*downConnection, e
|
||||||
|
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
if c.down[id] != nil {
|
if c.down[id] != nil || (c.up != nil && c.up[id] != nil) {
|
||||||
conn.pc.Close()
|
conn.pc.Close()
|
||||||
return nil, errors.New("Adding duplicate connection")
|
return nil, errors.New("Adding duplicate connection")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue