Commit 57163c70 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Better protection against duplicate connection ids.

parent 6005ad9e
......@@ -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")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment