go.crypto/ssh: only offset channel IDs when debugMux is
set. Otherwise, the package leaks data about total number of connections established through its channel IDs. R=agl, jpsugar CC=golang-codereviews https://golang.org/cl/87280043
This commit is contained in:
committed by
Adam Langley
parent
7e43632730
commit
058f0eec52
+6
-2
@@ -99,7 +99,8 @@ type mux struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// Each new chanList instantiation has a different offset.
|
||||
// When debugging, each new chanList instantiation has a different
|
||||
// offset.
|
||||
var globalOff uint32
|
||||
|
||||
func (m *mux) Wait() error {
|
||||
@@ -120,7 +121,10 @@ func newMux(p packetConn) *mux {
|
||||
incomingRequests: make(chan *Request, 16),
|
||||
errCond: newCond(),
|
||||
}
|
||||
m.chanList.offset = atomic.AddUint32(&globalOff, 1)
|
||||
if debugMux {
|
||||
m.chanList.offset = atomic.AddUint32(&globalOff, 1)
|
||||
}
|
||||
|
||||
go m.loop()
|
||||
return m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user