Skip to content

Commit fbbc3db

Browse files
committed
Adapt server to the updarted proxy logic
1 parent 6b6483f commit fbbc3db

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cmd/ssh/server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ and proxies them to local SSH daemon processes.
4949
DefaultPort: 7772,
5050
PortRange: 100,
5151
}
52-
return ssh.RunServer(ctx, client, opts)
52+
err := ssh.RunServer(ctx, client, opts)
53+
if err != nil && ssh.IsNormalClosure(err) {
54+
return nil
55+
}
56+
return err
5357
}
5458

5559
return cmd

libs/ssh/server.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (handler *sshHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
137137
return
138138
}
139139

140-
proxy := newProxyConnection()
140+
proxy := newProxyConnection(nil)
141141
err := proxy.Accept(w, r)
142142
if err != nil {
143143
cmdio.LogError(ctx, fmt.Errorf("failed to upgrade to websockets: %v", err))
@@ -189,11 +189,7 @@ func (handler *sshHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
189189
})
190190

191191
g.Go(func() error {
192-
return proxy.RunReceivingLoop(gCtx, sshdStdin)
193-
})
194-
195-
g.Go(func() error {
196-
return proxy.RunSendingLoop(gCtx, sshdStdout)
192+
return proxy.Start(gCtx, sshdStdout, sshdStdin)
197193
})
198194

199195
if err := g.Wait(); err != nil {

0 commit comments

Comments
 (0)