view docs/xsls/changes.xsls @ 8355:ad3a6f069498 quic

Added proper handling of connection close phases. There are following flags in quic connection: closing - true, when a connection close is initiated, for whatever reason draining - true, when a CC frame is received from peer The following state machine is used for closing: +------------------+ | I/HS/AD | +------------------+ | | | | | V | | immediate close initiated: | | reasons: close by top-level protocol, fatal error | | + sends CC (probably with app-level message) | | + starts close_timer: 3 * PTO (current probe timeout) | | | | | V | | +---------+ - Reply to input with CC (rate-limited) | | | CLOSING | - Close/Reset all streams | | +---------+ | | | | | V V | | receives CC | | | | idle | | timer | | | V | | +----------+ | - MUST NOT send anything (MAY send a single CC) | | DRAINING | | - if not already started, starts close_timer: 3 * PTO | +----------+ | - if not already done, close all streams | | | | | | | close_timer fires | | V V +------------------------+ | CLOSED | - clean up all the resources, drop connection +------------------------+ state completely The ngx_quic_close_connection() function gets an "rc" argument, that signals reason of connection closing: NGX_OK - initiated by application (i.e. http/3), follow state machine NGX_DONE - timedout (while idle or draining) NGX_ERROR - fatal error, destroy connection immediately The PTO calculations are not yet implemented, hardcoded value of 5s is used.
author Vladimir Homutov <vl@nginx.com>
date Thu, 23 Apr 2020 13:41:08 +0300
parents 529f10f7757c
children e79c7521aaf4
line wrap: on
line source

X:stylesheet {

X:output method="text";

X:param lang="'en'";
X:param configuration="'../xml/change_log_conf.xml'";

X:var conf = "document($configuration)/configuration";
X:var start = "$conf/start";
X:var indent = "$conf/indent";
X:var max = "$conf/length";
X:var br = {&lt;br&gt;}


X:template = "/" { !! "change_log"; }
X:template = "change_log" { !! "changes"; }


X:template = "changes" {
    X:text {&#10;}

    !{substring(concat($conf/changes[@lang=$lang]/title,
                       //change_log/@title,
                       ' ', @ver,
                       '                                                    '),
                1, $conf/changes[@lang=$lang]/length)}

    X:if "$lang='ru'" {
        !{substring(@date, 9, 2)}
        X:text {.}
        !{substring(@date, 6, 2)}
        X:text {.}
        !{substring(@date, 1, 4)}
    }

    X:if "$lang='en'" {
        !{substring(@date, 9, 2)}
        !{$conf/changes[@lang=$lang]/month[number(substring(current()/@date,
                                                            6, 2))]}
        !{substring(@date, 1, 4)}
    }

    X:text {&#10;}

    !! "change";

    X:text {&#10;}
}


X:template = "change" {
    X:var prefix = "$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]"

    X:var postfix = { X:if "$prefix" { X:text {: } } }

    !! "para[@lang=$lang]" (prefix = "concat($start, $prefix, $postfix)");
}


X:template para(prefix) = "para" {
    X:var text = { !!; }

    X:text {&#10;}

    !wrap(text = "normalize-space($text)",
          prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } })
}


X:template wrap(text, prefix) {
    X:if "$text" {
        X:var offset = {
            X:choose {
                X:when "starts-with($text, concat($br, ' '))" {
                    !{string-length($br) + 2}
                }
                X:when "starts-with($text, $br)" {
                    !{string-length($br) + 1}
                }
                X:otherwise {
                    1
                }
            }
        }

        X:var length = {
            !length(text = "substring($text, $offset)",
                    prefix = "string-length($prefix)",
                    length = "$max")
        }

        !{$prefix}

        !{normalize-space(translate(substring($text, $offset, $length),
                                    '&#xA0;', ' '))}

        X:text {&#10;}

        !wrap(text = "substring($text, $length + $offset)", prefix = "$indent")
    }
}


X:template length(text, prefix, length) {
    X:var break = "substring-before(substring($text, 1,
                                    $length - $prefix + string-length($br)),
                                    $br)"

    X:choose {
        X:when "$break" { !{string-length($break)} }

        X:when "$length = 0" { !{$max - $prefix} }

        X:when "string-length($text) + $prefix &lt;= $length" {
            !{$length - $prefix}
        }

        X:when "substring($text, $length - $prefix + 1, 1) = ' '" {
            !{$length - $prefix + 1}
        }

        X:otherwise {
            !length(text = "$text", prefix = "$prefix", length = "$length - 1")
        }
    }
}


X:template = "at" {@}
X:template = "br" { !{$br} }
X:template = "nobr" { !{translate(., ' ', '&#xA0;')} }


}