packer/rpc: muxconn can't use stream ID 0 ever
This commit is contained in:
parent
7177cc149f
commit
ae37050e8a
|
@ -1,6 +1,8 @@
|
|||
## 0.5.1 (unreleased)
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
* core: If a stream ID loops around, don't let it use stream ID 0 [GH-767]
|
||||
|
||||
## 0.5.0 (12/30/2013)
|
||||
|
||||
|
|
|
@ -191,13 +191,13 @@ func (m *MuxConn) NextId() uint32 {
|
|||
m.muAccept.Lock()
|
||||
defer m.muAccept.Unlock()
|
||||
|
||||
for {
|
||||
// We never use stream ID 0 because 0 is the zero value of a uint32
|
||||
// and we want to reserve that for "not in use"
|
||||
if m.curId == 0 {
|
||||
m.curId = 1
|
||||
}
|
||||
|
||||
for {
|
||||
result := m.curId
|
||||
m.curId += 1
|
||||
if _, ok := m.streamsAccept[result]; !ok {
|
||||
|
|
Loading…
Reference in New Issue