aboutsummaryrefslogtreecommitdiff
path: root/src/core/idhash.h
Commit message (Collapse)AuthorAge
* fixes #2148 Old id_reg_map seems not be freedGarrett D'Amore2025-08-25
| | | | | This simplifies the code to just use a precompiled static list. This should be lighter weight, and provably free from leaks.
* idhash: introduce nni_idhash_count.Garrett D'Amore2024-10-05
| | | | This will be used for some follow up work (UDP).
* idhash: add nng_id_visit APIGarrett D'Amore2024-08-11
| | | | | | This allows an efficient way to iterate over the entries stored in an ID hash. The iteration is fast, and requires no additional storage. The order of iteration is not guaranteed.
* fixes #1740 Public ID hash APIGarrett D'Amore2023-12-29
| | | | | | | | | This includes a manual page documenting the entire set of functions in one step. The hash is 64-bit based for now, to be maximally flexible. An internal 32-bit convenience for the common internal use is also provided (not public). The public API includes a test suite.
* 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.
* fixes #1289 zerotier should have it's own copy of the id hashing codeGarrett D'Amore2020-08-16
| | | | | | | | | | | fixes #1288 id allocation can overallocate fixes #1126 consider removing lock from idhash This substantially refactors the id hash code, giving a cleaner API, and eliminating a extra locking as well as some wasteful allocations. The ZeroTier code has it's own copy, that is 64-bit friendly, as the rest of the consumers need only a simpler 32-bit API.
* fixes #581 nni_idhash could use 32-bit variantGarrett D'Amore2018-07-06
|
* fixes #396 illumos doesn't build (missing NNG_PLATFORM_POSIX ON)Garrett D'Amore2018-05-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #397 Need to cast zoneid fixes #395 sun is predefined on illumos/Solaris fixes #394 alloca needs to #include <alloca.h> fixes #399 Cannot use SVR4.2 specific msghdr fixes #402 getpeerucred needs a NULL initialized ucred fixes #403 syntax error in posix_tcp - attempt to return void fixes #407 illumos getegid wrong fixes #406 nni_idhash_count is dead code fixes #404 idhash typedef redeclared fixes #405 warning: newline not last character in file This is basically a slew of related bug fixes required to make this work on illumos. Note that the fixes are not "complete", because more work is required to support port events given that epoll is busted on illumos. We also fixed a bunch of things that aren't actually "bugs" per se, but really just warnings. Silencing them makes things better for everyone. Apparently not all compilers are equally happy with redundant (but otherwise identical) typedefs; we use structs in some places instead of shorter type names to silence these complaints. Note that IPC permissions (the mode bits on the socket vnode) are not validated on SunOS systems. This change includes documentation to reflect that.
* fixes #334 Separate context for state machines from socketsGarrett D'Amore2018-04-10
| | | | | | | | | | | | | | | This provides context support for REQ and REP sockets. More discussion around this is in the issue itself. Optionally we would like to extend this to the surveyor pattern. Note that we specifically do not support pollable descriptors for non-default contexts, and the results of using file descriptors for polling (NNG_OPT_SENDFD and NNG_OPT_RECVFD) is undefined. In the future, it might be nice to figure out how to factor in optional use of a message queue for users who want more buffering, but we think there is little need for this with cooked mode.
* Add support for 64-bit ids in idhash.Garrett D'Amore2017-08-22
| | | | | | | | | | | We intend to use this with transports where dynamic "port numbers" might be 32-bits. This would allow us to formulate a 64-bit number representing a conversation, and be able to find that conversation by the 64-bit value. Note that the hashed values are probably not perfectly optimal, as only the low order bits are particularly significant in the hash. We might want to consider XOR'ing in the upper bits to address that.
* Remove unused idhash_reclaim.Garrett D'Amore2017-08-07
|
* idhash has it's own lock now.Garrett D'Amore2017-07-13
|
* Make idhash non-inlined (so we can add a mutex.)Garrett D'Amore2017-07-13
|
* Give up on uncrustify; switch to clang-format.Garrett D'Amore2017-07-10
|
* Introduce new generic I/O event framework.Garrett D'Amore2017-02-19
|
* 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.)
* Added dynamic ID generation & management for idhash tables.Garrett D'Amore2017-01-17
| | | | | | This will allow us to use idhash tables to manage id handles a bit more flexibly. For example, sockets, pipe IDs, etc. can all be generated, and we can use hash tables to ensure that values do not collide.
* Richer tests and fixes for idhash. Also dynamically allocate idhash.Garrett D'Amore2016-12-29
|
* Implementation of an id hash for hashing pipes by ID.Garrett D'Amore2016-12-29
We use some hints from Python's dict implementation, using an open addressing scheme, and just ripping off the lower bits as needed. Since we assign IDs consecutively, this should work well. We shrink the table when it is only 1/8 full, and we ensure that we grow the table when it is 2/3 full. (The growth will start by at minimum doubling the required size.)