go.crypto/ssh: make {client,server}Chan use common window management

R=agl, gustav.paul, kardianos
CC=golang-dev
https://golang.org/cl/6208043
This commit is contained in:
Dave Cheney
2012-05-11 05:56:44 +10:00
parent 523290a72d
commit 8a2e7c966a
4 changed files with 76 additions and 82 deletions
+5 -4
View File
@@ -543,18 +543,19 @@ func (s *ServerConn) Accept() (Channel, error) {
case *channelOpenMsg:
c := &serverChan{
channel: channel{
conn: s,
remoteId: msg.PeersId,
conn: s,
remoteId: msg.PeersId,
remoteWin: window{Cond: newCond()},
},
theirWindow: msg.PeersWindow,
chanType: msg.ChanType,
maxPacketSize: msg.MaxPacketSize,
extraData: msg.TypeSpecificData,
myWindow: defaultWindowSize,
serverConn: s,
cond: sync.NewCond(new(sync.Mutex)),
cond: newCond(),
pendingData: make([]byte, defaultWindowSize),
}
c.remoteWin.add(msg.PeersWindow)
s.lock.Lock()
c.localId = s.nextChanId
s.nextChanId++