func (s *Server) handlePTYReq(ch ssh.Channel, req *ssh.Request, ctx *ctx) error {
	var (
		params *rsession.TerminalParams
		err    error
		term   *terminal
	)
	r, err := parsePTYReq(req)
	if err != nil {
		return trace.Wrap(err)
	}
	params, err = rsession.NewTerminalParamsFromUint32(r.W, r.H)
	if err != nil {
		return trace.Wrap(err)
	}
	ctx.Debugf("[SSH] terminal requested of size %v", *params)

	// already have terminal?
	if term = ctx.getTerm(); term == nil {
		term, params, err = requestPTY(req)
		if err != nil {
			return trace.Wrap(err)
		}
		ctx.setTerm(term)
	}
	term.setWinsize(*params)

	// update the session:
	if err := s.reg.notifyWinChange(*params, ctx); err != nil {
		log.Error(err)
	}
	return nil
}
// handlePTYReq allocates PTY for this SSH connection per client's request
handlePTYReq allocates PTY for this SSH connection per client's request
// handlePTYReq allocates PTY for this SSH connection per client ' s request
func (s *Server) handlePTYReq(ch ssh.Channel, req *ssh.Request, ctx *ctx) error {
	var (
		params *rsession.TerminalParams
		err    error
		term   *terminal
	)
	r, err := parsePTYReq(req)
	if err != nil {
		return trace.Wrap(err)
	}
	params, err = rsession.NewTerminalParamsFromUint32(r.W, r.H)
	if err != nil {
		return trace.Wrap(err)
	}
	ctx.Debugf("[SSH] terminal requested of size %v", *params)
	if term = ctx.getTerm(); term == nil {
		term, params, err = requestPTY(req)
		if err != nil {
			return trace.Wrap(err)
		}
		ctx.setTerm(term)
	}
	term.setWinsize(*params)
	if err := s.reg.notifyWinChange(*params, ctx); err != nil {
		log.Error(err)
	}
	return nil
}
func ( s * Server ) handlePTYReq ( ch ssh . Channel , req * ssh . Request , ctx * ctx ) error { var ( params * rsession . TerminalParams err error term * terminal ) r , err := parsePTYReq ( req ) if err != nil { return trace . Wrap ( err ) } params , err = rsession . NewTerminalParamsFromUint32 ( r . W , r . H ) if err != nil { return trace . Wrap ( err ) } ctx . Debugf ( " " , * params ) if term = ctx . getTerm ( ) ; term == nil { term , params , err = requestPTY ( req ) if err != nil { return trace . Wrap ( err ) } ctx . setTerm ( term ) } term . setWinsize ( * params ) if err := s . reg . notifyWinChange ( * params , ctx ) ; err != nil { log . Error ( err ) } return nil }
handlePTYReq allocates PTY for this SSH connection per client's request
handlePTYReq allocates PTY for this SSH connection per client ' s request
// already have terminal? // update the session: