Documentation
¶
Overview ¶
Package winch distributes a session's window-size changes to every reader that wants them.
ssh.Session.Pty returns one channel per session, on SSH and telnet alike, so only one reader can take each change. The session loop that resizes the terminal ranged over it for the whole connection, and the full-screen editor, a door and a file transfer each took from the same channel while they ran, so whichever reader won the receive got the change and the others missed it. The session loop now owns the channel through a Hub and the others subscribe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub takes a session's window changes from the one channel its transport provides and hands each to every subscriber.
func Own ¶
Own gives s a Hub that takes src's changes from now on, and returns the owner's subscription, which sees every change src delivers, including one already waiting in it. Call Close when the session ends: a transport that never closes src would otherwise keep the Hub's goroutine.
func (*Hub) Close ¶
func (h *Hub) Close()
Close ends every subscription by closing its channel, stops taking from the source and forgets the Hub, so Subscribe for the session falls back to Pty.
The Hub is forgotten before any subscriber's channel closes, and under the same lock that Subscribe takes, so a reader that sees its channel closed and then looks the session up, or subscribes again, finds the Hub gone. With the registry removed after the unlock, as before, a reader could run between the two and still find it (#906).