Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chansrv timer queue needs some attention #2906

Open
matt335672 opened this issue Jan 5, 2024 · 0 comments
Open

Chansrv timer queue needs some attention #2906

matt335672 opened this issue Jan 5, 2024 · 0 comments

Comments

@matt335672
Copy link
Member

matt335672 commented Jan 5, 2024

xrdp version

devel

Problem description

Chansrv has a timer queue in chansrv/chansrv.c.

Events are added to the queue with add_timeout(). The caller specifies a time msoffset milli-seconds in the future and a callback function which is called when this time is reached.

There are a couple of problems with this code:-

  1. The milli-second time value is stored in a 32-bit unsigned int:-
    struct timeout_obj
    {
    tui32 mstime;
    void *data;
    void (*callback)(void *data);
    struct timeout_obj *next;
    };

    This value wraps round every 49.7 days. Because of the way time comparisons are done, a wraparound of the value will cause timer events to stop firing.
  2. The timer queue is unordered. This means the whole timer queue has to be scanned every time the next timeout has to be calculated. Storing the timer queue in time-order would mean just the earliest event could be considered.

At present the timer queue is only called from the RAIL code so addressing this is a relatively low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant