aboutsummaryrefslogtreecommitdiff
path: root/src/lib/dispatch/dispatch_new.c
AgeCommit message (Collapse)Author
2019-10-01Fix a crash bug in max_u16_in_sl()Nick Mathewson
The documentation for this function says that the smartlist can contain NULLs, but the code only handled NULLs if they were at the start of the list. We didn't notice this for a long time, because when Tor is run normally, the sequence of msg_id_t is densely packed, and so this list (mapping msg_id_t to channel_id_t) contains no NULL elements. We could only run into this bug: * when Tor was running in embedded mode, and starting more than once. * when Tor ran first with more pubsub messages enabled, and then later with fewer. * When the second run (the one with fewer enabled pubsub messages) had at least some messages enabled, and those messages were not the ones with numerically highest msg_id_t values. Fixes bug 31898; bugfix on 47de9c7b0a828de7fb8129413db70bc4e4ecac6d in 0.4.1.1-alpha.
2019-10-01Rename max_in_sl to max_in_u16_sl, and expose it as STATIC.Nick Mathewson
Since we want to make this function slightly more visible for testing purposes, it needs a better name.
2019-03-25Use actual pointers in dispatch_cfg.c.Nick Mathewson
Previously, I had used integers encoded as pointers. This introduced a flaw: NULL represented both the integer zero, and the absence of a setting. This in turn made the checks in cfg_msg_set_{type,chan}() not actually check for an altered value if the previous value had been set to zero. Also, I had previously kept a pointer to a dispatch_fypefns_t rather than making a copy of it. This meant that if the dispatch_typefns_t were changed between defining the typefns and creating the dispatcher, we'd get the modified version. Found while investigating coverage in pubsub_add_{pub,sub}_()
2019-03-25Low-level dispatch module for publish-subscribe mechanismNick Mathewson
This module implements a way to send messages from one module to another, with associated data types. It does not yet do anything to ensure that messages are correct, that types match, or that other forms of consistency are preserved.