Update docs, remove needless condition check
This commit is contained in:
parent
97cbdca84a
commit
1ff58a3de7
3 changed files with 4 additions and 8 deletions
|
|
@ -163,7 +163,7 @@ func (fwd *PortForwarder) handleConnection(ctx context.Context, id channelID, co
|
|||
connReader io.Reader = conn
|
||||
)
|
||||
|
||||
// If we the port forwader has been configured to keep the session alive
|
||||
// If the forwader has been configured to keep the session alive
|
||||
// it will monitor the I/O and notify the session of the traffic.
|
||||
if fwd.keepAlive {
|
||||
channelReader = newTrafficMonitor(channelReader, fwd.session, "output")
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ func (s *Session) StartSSHServer(ctx context.Context) (int, string, error) {
|
|||
return port, response.User, nil
|
||||
}
|
||||
|
||||
// heartbeat ticks every interval and sends a signal to the Live Share host to keep
|
||||
// the connection alive if there is a reason to do so.
|
||||
// heartbeat runs until context cancellation, periodically checking whether there is a
|
||||
// reason to keep the connection alive, and if so, notifying the Live Share host to do so.
|
||||
func (s *Session) heartbeat(ctx context.Context, interval time.Duration) {
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
|
|
|
|||
|
|
@ -230,16 +230,12 @@ func TestInvalidHostKey(t *testing.T) {
|
|||
|
||||
func TestKeepAliveNonBlocking(t *testing.T) {
|
||||
session := &Session{keepAliveReason: make(chan string, 1)}
|
||||
var i int
|
||||
for ; i < 2; i++ {
|
||||
for i := 0; i < 2; i++ {
|
||||
session.keepAlive("io")
|
||||
}
|
||||
|
||||
// if keepAlive blocks, we'll never reach this and timeout the test
|
||||
// timing out
|
||||
if i != 2 {
|
||||
t.Errorf("unexpected iteration account, expected: 2, got: %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotifyHostOfActivity(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue