devserver: Better accounting of limited update responses.
This is a revision of the dedupe mechanism used for limiting the number
of updates that a client can get from a devserver (a feature that was
originally added to compensate for the lack of a true rule-based
handling of update requests). The way it is currently implemented
sometimes results in a situation where a client receives a "no update"
response instead of the expected "update available" response.
With this change, the devserver only decrements the allowed updates
counter when it receives an event notification from the client that the
download of an update has actually started. Unlike the update request,
whose handling may time out and lead to retransmits, this event is
a unique indication that a client has actually consumed the update. As
before, this accounting is done within a critical section, to prevent
This also takes care of another TODO item: when the devserver receives
a non-update ping, it will correctly return an ack (instead of a "no
update" response, as it currently does).
Finally, this prepends an underscore to internal constant names in
Tested-by: Gilad Arnold <firstname.lastname@example.org>
Reviewed-by: Chris Sosa <email@example.com>
Commit-Queue: Gilad Arnold <firstname.lastname@example.org>
2 files changed