Skip to content

Is ikcp_check really useful? #448

@jamboree

Description

@jamboree

The doc for ikcp_check says:

Determine when should you invoke ikcp_update

and in ikcp_check

kcp/ikcp.c

Line 1211 in f4f3a89

tm_flush = _itimediff(ts_flush, current);

kcp/ikcp.c

Line 1222 in f4f3a89

minimal = (IUINT32)(tm_packet < tm_flush ? tm_packet : tm_flush);

the return timepoint may be less than ts_flush.

However, in ikcp_update

kcp/ikcp.c

Line 1164 in f4f3a89

slap = _itimediff(kcp->current, kcp->ts_flush);

kcp/ikcp.c

Lines 1171 to 1177 in f4f3a89

if (slap >= 0) {
kcp->ts_flush += kcp->interval;
if (_itimediff(kcp->current, kcp->ts_flush) >= 0) {
kcp->ts_flush = kcp->current + kcp->interval;
}
ikcp_flush(kcp);
}

ikcp_flush is called only if the current timepoint is greater or equal to ts_flush, which makes ikcp_check pointless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions