Browse Source

fix chDesc race

pull/456/head
Ethan Buchman 8 years ago
parent
commit
929cf433b9
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      connection.go

+ 2
- 1
connection.go View File

@ -115,7 +115,8 @@ func NewMConnection(config cfg.Config, conn net.Conn, chDescs []*ChannelDescript
var channels = []*Channel{} var channels = []*Channel{}
for _, desc := range chDescs { for _, desc := range chDescs {
channel := newChannel(mconn, desc)
descCopy := *desc // copy the desc else unsafe access across connections
channel := newChannel(mconn, &descCopy)
channelsIdx[channel.id] = channel channelsIdx[channel.id] = channel
channels = append(channels, channel) channels = append(channels, channel)
} }


Loading…
Cancel
Save