Releases: FedeDP/libmodule
Releases · FedeDP/libmodule
v3.0.0
New libmodule release; highlights:
New Features
- You can now send any data through libmodule pubsub api
- Avoid strdupping /mallocing data sent through pubsub api, trusting user pointers
Api breaks
- module_register_fd() now takes an autoclose boolean parameter; set it to true if you wish the fd to be closed at module stop or at fd deregistration.
- module_register_fd() now takes an userptr, that will be forwarded in receive() callback through msg->fd_msg->userptr.
- module_deregister_fd() does not take a "close" parameter anymore
- modules_quit() now takes an "exit_code" parameter. Its value will be returned by modules_loop.
- Dropped module_update_fd() function
- Dropped module_add_fd() alias function (it was aliasing module_register_fd())
- Dropped module_rm_fd() alias function (it was aliasing module_deregister_fd())
Generic improvements
- Install license file in /usr/share/licenses/libmodule/
- Added 2 more headers: <module/module_easy.h> and <module/modules_easy.h>
- constify as much as possible
- MODULE ctor now has a lower priority; this way a developer can calls its own ctors before
- Use stdbool where needed
Fixes
- Always use memhook!
- Fixed memleak in hashmap_rehash() internal function
- Avoid stopping an already-stopped module when deregistering a module
v2.1.1
v2.1.0, async pubsub
A new release of libmodule is out.
This release cycle focused on improving pubsub API, on stability and fixes.
New features
- PubSub messaging API is now async: when telling(publishing) a message, the message itself will be malloc'd and its address written to write end's pipe of each module (that is eventually subscribed to the topic); modules_ctx_loop() will then read the message from read end's of pipe, read the messge address and call module's receive().
- Added module_unsubscribe, module_register_topic, module_deregister_topic.
- Added LOOP_STARTED, LOOP_STOPPED, TOPIC_REGISTERED, TOPIC_DEREGISTERED pubsub messages coming directly from libmodule; TOPIC_(DE)REGISTERED messages will carry new topic too.
- Renamed module_add(rm)fd to module(de)register_fd. Old API is available through a compatibility macro.
- You can now (de)register an fd for stopped modules too.
Fixes
- Fixed issues with module_stop that did not cleanly wiped module->fds, preventing a subsequent module_start to be successful.
- Forcefully deregister all fds when deregistering a module to avoid memleak if a stopped module gets some fds registered but never gets re-started
- Fixed scope of hashmap keys: when passing a locally scoped variable as key in hashmap_put, at next access it would crash as it only stored a pointer. It properly calls strdup() now.
- Actually bump soversion.
Tests
- Added new tests for new API functions.
Docs
- Updated docs.
v2.0.0
API improvements/breaks
- Logger function now has a self_t* parameter instead of moduleName and ctxName
- Added 2 functions: module_get_name() and module_get_context() to retrieve moduleName and ctxName from a self_t*
- Added module_reply() function to reply to a PubSub message received from a self_t*
- msg_t type now has a flag "is_pubsub" and an union of fd/pubsub_msg_t*
- pubsub_msg_t now carries self_t* instead of sender name
- Users can now specify different memory management functions (see modules_set_memalloc_hook()). By default malloc, realloc, calloc and free will be used.
Fixes
- Correctly export 3 macros: MODULE_VERSION_MAJ, MODULE_VERSION_MIN and MODULE_VERSION_PAT
- Correctly install module_cmn.h header too. This prevented libmodule to be actually used by developers.
Other improvements
- Better build system
- Added some tests