Skip to content

Commit

Permalink
Fix panic with missing request handler
Browse files Browse the repository at this point in the history
Fixes #102
  • Loading branch information
belak committed Apr 25, 2019
1 parent 9253a53 commit a9daacc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Server struct {
LocalPortForwardingCallback LocalPortForwardingCallback // callback for allowing local port forwarding, denies all if nil
ReversePortForwardingCallback ReversePortForwardingCallback // callback for allowing reverse port forwarding, denies all if nil
DefaultServerConfigCallback DefaultServerConfigCallback // callback for configuring detailed SSH options
SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions
SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions

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

0 comments on commit a9daacc

Please sign in to comment.