func()

in internal/sshd/connection.go [161:182]


func (c *connection) sendKeepAliveMsg(ctx context.Context, sconn *ssh.ServerConn, ticker *time.Ticker) {
	ctxlog := log.WithContextFields(ctx, log.Fields{"remote_addr": c.remoteAddr})

	for {
		select {
		case <-ctx.Done():
			return
		case <-ticker.C:
			ctxlog.Debug("connection: sendKeepAliveMsg: send keepalive message to a client")

			status, payload, err := sconn.SendRequest(KeepAliveMsg, true, nil)
			if err != nil {
				ctxlog.Errorf("Error occurred while sending request :%v", err)
				return
			}

			if status {
				ctxlog.Debugf("connection: sendKeepAliveMsg: payload: %v", string(payload))
			}
		}
	}
}