Skip to content

Commit a9daacc

Browse files
committed
Fix panic with missing request handler
Fixes #102
1 parent 9253a53 commit a9daacc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Server struct {
3232
LocalPortForwardingCallback LocalPortForwardingCallback // callback for allowing local port forwarding, denies all if nil
3333
ReversePortForwardingCallback ReversePortForwardingCallback // callback for allowing reverse port forwarding, denies all if nil
3434
DefaultServerConfigCallback DefaultServerConfigCallback // callback for configuring detailed SSH options
35-
SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions
35+
SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions
3636

3737
IdleTimeout time.Duration // connection timeout when no activity, none if empty
3838
MaxTimeout time.Duration // absolute connection timeout, none if empty
@@ -267,8 +267,10 @@ func (srv *Server) handleConn(newConn net.Conn) {
267267
func (srv *Server) handleRequests(ctx Context, in <-chan *gossh.Request) {
268268
for req := range in {
269269
handler, found := srv.requestHandlers[req.Type]
270-
if !found && req.WantReply {
271-
req.Reply(false, nil)
270+
if !found {
271+
if req.WantReply {
272+
req.Reply(false, nil)
273+
}
272274
continue
273275
}
274276
/*reqCtx, cancel := context.WithCancel(ctx)

0 commit comments

Comments
 (0)