File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,6 @@ func (srv *Server) ensureHostSigner() error {
5656}
5757
5858func (srv * Server ) config (ctx Context ) * gossh.ServerConfig {
59- srv .channelHandlers = map [string ]channelHandler {
60- "session" : sessionHandler ,
61- "direct-tcpip" : directTcpipHandler ,
62- }
6359 config := & gossh.ServerConfig {}
6460 for _ , signer := range srv .HostSigners {
6561 config .AddHostKey (signer )
@@ -164,6 +160,12 @@ func (srv *Server) Serve(l net.Listener) error {
164160 if srv .Handler == nil {
165161 srv .Handler = DefaultHandler
166162 }
163+ if srv .channelHandlers == nil {
164+ srv .channelHandlers = map [string ]channelHandler {
165+ "session" : sessionHandler ,
166+ "direct-tcpip" : directTcpipHandler ,
167+ }
168+ }
167169 var tempDelay time.Duration
168170
169171 srv .trackListener (l , true )
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ func (srv *Server) serveOnce(l net.Listener) error {
1818 if e != nil {
1919 return e
2020 }
21+ srv .channelHandlers = map [string ]channelHandler {
22+ "session" : sessionHandler ,
23+ "direct-tcpip" : directTcpipHandler ,
24+ }
2125 srv .handleConn (conn )
2226 return nil
2327}
You can’t perform that action at this time.
0 commit comments