Skip to content

chore: fix import ordering after module rename - #3

Merged
skevetter merged 1 commit into
mainfrom
fix-fmt
Apr 18, 2026
Merged

chore: fix import ordering after module rename#3
skevetter merged 1 commit into
mainfrom
fix-fmt

Conversation

@skevetter

@skevetter skevetter commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Fix gci import ordering in two example files after module rename from skevetter/ssh to devsy-org/ssh

@skevetter
skevetter merged commit 165ca9a into main Apr 18, 2026
5 checks passed
@skevetter
skevetter deleted the fix-fmt branch April 18, 2026 04:01
skevetter added a commit that referenced this pull request May 25, 2026
Addresses five divergences from OpenSSH sshd surfaced during review.

Channel-close hook (closes #1 of review)
  Previously openChannelSet.remove fired only on a SendRequest failure,
  so a connection that opened and cleanly closed many channels
  accumulated dead entries forever. any() always returned slot 0 — the
  oldest, most-likely-dead channel — degrading the OpenSSH-mirror mode
  into "always probe a dead channel, then fall back to global" within
  one tick. trackingNewChannel.Accept now proxies the per-channel
  request stream through a buffered (16, matching gossh's chanSize)
  forwarder goroutine; when the upstream reqs channel closes, an
  onClose callback prunes the set.

Remove the time.After race (closes #2 of review)
  connectionKeepAlive used a replyCh + time.After(interval) race
  around SendRequest. A reply arriving at interval+epsilon left
  keepAlive.Reset() un-called, ticking the false-disconnect counter
  for live-but-slow clients. Removed the outer timeout entirely. The
  inFlight semaphore already prevents overlapping probes; TimeIsUp
  enforces the deadline at the next tick; sshConn.Close on TimeIsUp
  unblocks any hung SendRequest.

Reset on any inbound traffic (closes #3 of review)
  OpenSSH resets its client-alive counter on every received packet.
  Added SessionKeepAlive.NotePeerActivity — like Reset but without
  bumping the KeepAliveReplyReceived metric. Called from
  Server.handleRequests (global requests), session.handleRequests
  (per-session requests), and the per-channel request forwarder in
  trackingNewChannel. Resets the ticker so the next probe fires
  ClientAliveInterval after the most recent activity, which also
  closes #4 (probe suppression on recent traffic) for free.

Unwrap helper + ChannelHandlers doc (closes #5 of review)
  Added Unwrap() gossh.NewChannel on trackingNewChannel so downstream
  handlers that need the underlying type can recover it. Documented
  the wrapping on Server.ChannelHandlers.

Test added: TestConnectionKeepAlivePrunesClosedChannels opens three
channels, closes them, then asserts subsequent keepalives over a 1s
window are global-only (0 channel-typed, >=1 global). Without the
close hook, the dead channels in the set would force channel-typed
probes that fail and prune one-at-a-time over many intervals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant