OK, so one thing I've noticed is that it doesn't seem to take concurrency into account. Previously the linked lists were created at startup before Kamailio forks and then left alone, but modifying a linked list during runtime with multiple processes accessing the shared memory simultaneously is not safe. There are ways to make this safe using atomic ops and CAS (not sure if Kamailio really supports this), or alternatively locking must be used. This would also make it possible (and preferable) to support full deletion of allocated structs (sets and nodes) instead of just marking them as deleted.

The var rtpp_set_list deserves special mention as it's initialized to NULL and only updated during startup if any proxy sets are actually defined. If this is not the case, then the var will remain NULL. A later reload from DB would then cause the MI process to allocate all the structs and would set rtpp_set_list to non-NULL, but the other processes won't see this change as the var itself is not in shared memory (only its contents are).

As a minor note, Kamailio provides the macro STR_EQ(), which does the same thing as str_cmp().


Reply to this email directly or view it on GitHub.