aboutsummaryrefslogtreecommitdiff
path: root/src/core/init.c
Commit message (Collapse)AuthorAge
* fix includes for coreGarrett D'Amore2025-10-11
|
* Make pointers to data that is not modified const. (#2117)Søren Holm2025-04-27
| | | | | | This allow to pass constrant string i particular and constant data in general to nng functions. Co-authored-by: Garrett D'Amore <garrett@damore.org>
* init: use nng_errGarrett D'Amore2025-01-14
|
* resolver: default to just a single resolver threadGarrett D'Amore2024-12-28
| | | | | | | Nearly all applications are either purely server based (needing no resolvers really), or dialers only dialing a single destination. These do not need multiple dialers, and threads are expensive on some platforms (and they are more trouble during debugging.)
* fini: add drain mechanism for aio, reap, and task subsystemsGarrett D'Amore2024-12-07
| | | | | Make sure *everything* is drained before proceeding all the way to deallocation.
* aio: separate stop / shutdown from fini (deallocate)Garrett D'Amore2024-12-07
| | | | | | | | | | | | | | Probably other subsystems should get the same treatment. We need to basically start the process of shutting down so that subsystems know to cease operation before we rip memory out from underneath them. This ensures that no new operations can be started as well, once we have begun the process of teardown. We also enhanced the completion of sleep to avoid some extra locking contention, since the expiration *is* the completion. Includes a test for this case.
* refactor initialization/finalizationGarrett D'Amore2024-11-11
| | | | | | | | | Applications must now call nng_init(), but they can supply a set of parameters optionally. The code is now safe for multiple libraries to do this concurrently, meaning nng_fini no longer can race against another instance starting up. The nni_init checks on all public APIs are removed now.
* Announce NNG version in log.Garrett D'Amore2024-04-14
|
* fixes #1572 nng creates too many threadsGarrett D'Amore2024-01-01
| | | | | | | | | | | | This further limits some of the thread counts, but principally it offers a new runtime facility, nng_init_set_parameter(), which can be used to set certain runtime parameters on the number of threads, provided it is called before the rest of application start up. This facility is quite intentionally "undocumented", at least for now, as we want to limit our commitment to it. Still this should be helpful for applications that need to reduce the number of threads that are created.
* fixes #1729 remove nni_timerGarrett D'Amore2023-12-17
|
* ID map static initialization support.Garrett D'Amore2021-12-06
| | | | This also arranges to clean up the maps at nng_fini time.
* Use static initialization for lists and mutexes.Garrett D'Amore2021-12-05
| | | | | | This eliminates some run-time initialization, moving it to compile time. Additional follow up work will expand on this to simplify initialization and reduce the need for certain locks.
* SP initialization cannot fail.Garrett D'Amore2021-09-06
|
* Remove separate protocol initialization step.Garrett D'Amore2021-08-07
| | | | | Nothing is using this, but it adds complexity and also requires additional lock activity each time a socket is opened.
* More symbol renamingGarrett D'Amore2021-07-11
|
* fixes #1401 valgrind reports leaks in all testsGarrett D'Amore2021-01-03
| | | | | | | This arranges for nng_fini to be called via atexit in the test version of the library. It also cleans up some of the actual tests to reduce extraneous (and in some cases incorrect) calls to nng_fini.
* fixes #1005 TLS 1.3 supportGarrett D'Amore2020-02-23
| | | | | | | | This introduces support for an external wolfSSL plugin, and generally creates the framework for pluggable TLS implementations. The wolfSSL engine is provided via an external module (git submodule), available either under a GPLv3 license or a commercial license.
* fixes #1083 Random number improvementsGarrett D'Amore2020-01-01
|
* fixes #4 Statistics supportGarrett D'Amore2018-09-03
| | | | | | | | | | | | | | | | This introduces new public APIs for obtaining statistics, and adds some generic stats for dialers, listeners, pipes, and sockets. Also added are stats for inproc and pairv1 protocol. The other protocols and transports will have stats added incrementally as time goes on. A simple test program, and man pages are provided for this. Start by looking at nng_stat(5). Statistics does have some impact, and they can be disabled by using the advanced NNG_ENABLE_STATS (setting it to OFF, it's ON by default) if you need to build a minimized configuration.
* fixes #568 Want a single reader/write lock on socket child objectsGarrett D'Amore2018-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #170 Make more use of reaper This is a complete restructure/rethink of how child objects interact with the socket. (This also backs out #576 as it turns out not to be needed.) While 568 says reader/writer lock, for now we have settled for a single writer lock. Its likely that this is sufficient. Essentially we use the single socket lock to guard lists of the socket children. We also use deferred deletion in the idhash to facilitate teardown, which means endpoint closes are no longer synchronous. We use the reaper to clean up objects when the reference count drops to zero. We make a special exception for pipes, since they really are not reference counted by their parents, and they are leaf objects anyway. We believe this addresses the main outstanding race conditions in a much more correct and holistic way. Note that endpoint shutdown is a little tricky, as it makes use of atomic flags to guard against double entry, and against recursive lock entry. This is something that would be nice to make a bit more obvious, but what we have is safe, and the complexity is at least confined to one place.
* fixes #522 Separate out the endpoint plumbingGarrett D'Amore2018-06-27
| | | | | | | | | | This separates the plumbing for endpoints into distinct dialer and listeners. Some of the transports could benefit from further separation, but we've done some rather larger separation e.g. for the websocket transport. IPC would be a good one to update later, when we start looking at exposing a more natural underlying API.
* Fix possible use-after-free reaping things using random.Garrett D'Amore2018-01-05
|
* fixes #2 Websocket transportGarrett D'Amore2017-12-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather large changeset -- it fundamentally adds websocket transport, but as part of this changeset we added a generic framework for both HTTP and websocket. We also made some supporting changes to the core, such as changing the way timeouts work for AIOs and adding additional state keeping for AIOs, and adding a common framework for deferred finalization (to avoid certain kinds of circular deadlocks during resource cleanup). We also invented a new initialization framework so that we can avoid wiring in knowledge about them into the master initialization framework. The HTTP framework is not yet complete, but it is good enough for simple static serving and building additional services on top of -- including websocket. We expect both websocket and HTTP support to evolve considerably, and so these are not part of the public API yet. Property support for the websocket transport (in particular address properties) is still missing, as is support for TLS. The websocket transport here is a bit more robust than the original nanomsg implementation, as it supports multiple sockets listening at the same port sharing the same HTTP server instance, discriminating between them based on URI (and possibly the virtual host). Websocket is enabled by default at present, and work to conditionalize HTTP and websocket further (to minimize bloat) is still pending.
* Various man page fixups, add inproc header.Garrett D'Amore2017-10-24
| | | | | | | We added nng_inproc man page, and a header with an explicit registration method for it. We also fixed up the markup on several other pages, and corrected the include statements for nng_zerotier.
* Remove last vestiges of integer option numbers.Garrett D'Amore2017-09-27
|
* Add init/fini to protocols to allow them to register options.Garrett D'Amore2017-08-23
|
* Implement dynamic option numbering.Garrett D'Amore2017-08-23
| | | | | | | This permits option numbers to be allocated based on string name. Eventually all the option values will be replaced with option names. This will facilitate transports (ZeroTier) that may need further options.
* Provide versions of mutex, condvar, and aio init that never fail.Garrett D'Amore2017-08-16
| | | | | | | | | | | | | | | | | | | | | | | If the underlying platform fails (FreeBSD is the only one I'm aware of that does this!), we use a global lock or condition variable instead. This means that our lock initializers never ever fail. Probably we could eliminate most of this for Linux and Darwin, since on those platforms, mutex and condvar initialization reasonably never fails. Initial benchmarks show little difference either way -- so we can revisit (optimize) later. This removes a lot of otherwise untested code in error cases and so forth, improving coverage and resilience in the face of allocation failures. Platforms other than POSIX should follow a similar pattern if they need this. (VxWorks, I'm thinking of you.) Most sane platforms won't have an issue here, since normally these initializations do not need to allocate memory. (Reportedly, even FreeBSD has plans to "fix" this in libthr2.) While here, some bugs were fixed in initialization & teardown. The fallback code is properly tested with dedicated test cases.
* Subsystem initialize is idempotent; simplify cleanup.Garrett D'Amore2017-08-07
|
* Don't shut down taskq too soon.Garrett D'Amore2017-08-05
| | | | | | | With the new reapers, we've seen some problems caused by the reaper running after the taskq that they have to wait on (completion tasks for aios) are destroyed. We need to make sure that we tear down major subsystems in the correct order.
* Fix locking errors in endpoints, and simplify some logic.Garrett D'Amore2017-07-16
| | | | | | | This cleans up the pipe creation logic greatly, and eliminates a nasty potential deadlock (lock-order incorrect.) It also adds a corret binary exponential and randomized backoff on both accept and connect.
* AIO timeouts work correctly now, using their own timer logic.Garrett D'Amore2017-07-16
| | | | | | | | We closed a few subtle races in the AIO subsystem as well, and now we were able to eliminate the separate timer handling the MQ code. There appear to be some opportunities to further enhance the code for MQs as well -- eventually probably the only access to MQs will be with AIOs.
* Give up on uncrustify; switch to clang-format.Garrett D'Amore2017-07-10
|
* Refactor stop again, closing numerous races (thanks valgrind!)Garrett D'Amore2017-06-28
|
* Clean up the pipe system (no leaks).Garrett D'Amore2017-06-28
|
* Note that we have work to do to properly clean up. TBD.Garrett D'Amore2017-06-22
|
* Eliminate pipes global idhash.Garrett D'Amore2017-06-09
|
* Create the pipe object hash (not used yet).Garrett D'Amore2017-06-07
|
* Start of using objhash for endpoints.Garrett D'Amore2017-06-06
|
* New object hash implementation, used by socket (to start).Garrett D'Amore2017-06-05
|
* Timer implementation. Operations can timeout now?Garrett D'Amore2017-03-03
|
* Taskq implementation.Garrett D'Amore2017-02-18
|
* Add nni_ep_hold, nni_ep_hold_close, nni_ep_rele, nng_endpoint_close.Garrett D'Amore2017-01-24
|
* Fix leaks in bus, socket leaks, tighten up close-side refcnting.Garrett D'Amore2017-01-21
| | | | | | | | | | | | | | This does a few things. First it closes some preexisting leaks. Second it tightens the overall close logic so that we automatically discard idhash resources (while keeping numeric values for next id etc. around) when the last socket is closed. This then eliminates the need for applications to ever explicitly terminate resources. It turns out platform-specific resources established at nni_init() time might still be leaked, but it's also the case that we now no longer dynamically allocate anything at platform initialization time. (This presumes that the platform doesn't do so under the hood when creating critical sections or mutexes for example.)
* fixes #18 Sockets should be uint32_t's (handles) not pointers.Garrett D'Amore2017-01-20
|
* Pipe IDs are now tracked on global ID hashes.Garrett D'Amore2017-01-17
|
* New ISAAC pRNG. This replaces other local hacks for random data.Garrett D'Amore2017-01-08
| | | | | | Platforms must seed the pRNGs by offering an nni_plat_seed_prng() routine. Implementations for POSIX using various options (including the /dev/urandom device) are supplied.
* Transport renaming phase 1.Garrett D'Amore2017-01-02
|
* More C99-ification. Also end the _t thing for types (ISO C rules).Garrett D'Amore2016-12-22
|
* Uncrustify configuration, and shorter copyright banners, plus reformatGarrett D'Amore2016-12-21
| | | | code with uncrustify. (Minor adjustments.) No more arguments!