aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.c
Commit message (Collapse)AuthorAge
* Drop the protocol version for internal implementations.Garrett D'Amore2025-10-25
| | | | | | The ops vector / protocol API/ABI were meant to support external implementations, but we have moved away from having pluggable protocols, and we aren't likely to support it any time soon.
* Add stream direct address functions for socket addresses.Garrett D'Amore2025-10-25
| | | | | | | | This is going to be used to facilitate debugging, and eliminate some inconveniences around these things. We plan to move the pipe functions to use these directly, hopefully moving away from the pipe_getopt hack. (The transport API will need to grow these. For now this is just the streams.)
* fix includes for coreGarrett D'Amore2025-10-11
|
* Various header file fixes... also fix compilation errors when HTTP is disabled.v2.0.0-alpha.6Garrett D'Amore2025-10-05
| | | | | | Also, some instances nni_aio are changed to nng_aio. We think we want to harmonize some of these types going forward as it will reduce the need to include headers hopefully letting us get away with just "defs.h" in more places.
* 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.
* Converted property functions to use nng_err.Garrett D'Amore2025-04-27
|
* socket: rename nng_close to nng_socket_closeGarrett D'Amore2024-12-31
|
* pipes: fix crash caused by use after free race in rejectionGarrett D'Amore2024-12-30
|
* * MDF [core/socket] correct stat desc of rx_bytesJaylin2024-12-30
|
* fixes #961 surprising pipe event orderGarrett D'Amore2024-12-28
|
* transports: all transports use the new inline approachGarrett D'Amore2024-12-15
| | | | | | We can retire the old approach that used separate allocations, and all of the supporting code. This also gives us a more natural signature for the end point initializations.
* pipes and endpoints: support for inline allocations of transport dataGarrett D'Amore2024-12-08
| | | | | | | | | | | | | | | | | | | | | | This is a new transport API, which should make it easier for transports to rely upon lifetime guarantees made by the common SP framework, thus eliminating the need for transport specific reference counters, reap lists, and similar. The transport declares the size of the object in the ops vector (for pipe, dialer, or listener), and the framework supplies one allocated using the associated allocator. For now these add the pipe object to the socket and endpoint using linked linked lists. The plan is to transition those to reference counts which should be lighter weight and free form locking issues. The pipe teardown has been moved more fully to the reaper, to avoid some of the deadlocks that can occur as nni_pipe_close can be called from almost any context. For now the old API is retained as well, but the intention is to convert all the transports and then remove it.
* ctx: Simplify handling for closed contexts.Garrett D'Amore2024-12-07
| | | | | | Once a context has started the process of close, further attempts to close it will return NNG_ECLOSED. What was I thinking to ever do anything else?
* remove NNG_OPT_SOCKNAME (and socket names altogether)Garrett D'Amore2024-11-17
| | | | | | | | This functionality was provided principally for libnanomsg compatibility. This saves some memory and eliminates some pointless functionality. While here, updated the socket options documentation to remove references to options already removed.
* 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.
* Socket option handling clean ups for endpoints.Garrett D'Amore2024-11-03
| | | | | | | The framework for saving and replaying socket options was left over, and should not be used. But we do need to send the initial socket options to endpoints when creating them, so we have support for that in a cleaner fashion that does not require memory allocations.
* Remove NNI_TYPE_OPAQUE altogether.Garrett D'Amore2024-11-03
| | | | | | | | This also fixes a couple of minor bugs -- changing the socket name could be incorrect as the termination was not applied properly, and the ZeroTier code got a change -- note that it is only possible in this revised version to pass a single moon ID for ZT orbit. The ZT code is a bit stale, and untested anyway.
* Remove untyped nng_socket_get and nng_socket_set.Garrett D'Amore2024-11-03
|
* Replace NNG_OPT_SUB_SUBSCRIBE/UNSUBSCRIBE with functions.Garrett D'Amore2024-11-03
| | | | | The main purpose is to eliminate the NNI_TYPE_OPAQUE options, by putting these into their own first class, protocol-specific, functions.
* Replace `NNG_OPT_RAW` with `nng_socket_raw`.Garrett D'Amore2024-11-02
| | | | Similar to the other identities, this simplifies code a bit.
* Replace `NNG_OPT_PROTO`, `NNG_OPT_PROTONAME`, and friends with functions.Garrett D'Amore2024-11-02
| | | | | | Socket options were a little awkward, and these are core properties of the socket. Few if any applications need these. This also avoids some dynamic allocations.
* NNG_OPT_RECVFD and NNG_OPT_SENDFD converted to functions.Garrett D'Amore2024-11-02
| | | | | | | | | | These options are removed entirely, and their functionality is now available via special functions, `nng_socket_get_send_poll_fd` and `nng_socket_get_recv_poll_fd`, making these first class methods on the socket. This eliminates a bit of wasteful code, and provides type safety for these methods.
* remove legacy support for configuration of transport options on socketGarrett D'Amore2024-10-20
| | | | | | | | | Transport specific options should be configured on the end point. This has the most impact for TLS, as TLS dialers and listeners will need to be allocated apriori, to configure TLS options. Some legacy tests were removed... we're going to remove the legacy libnanomsg compatibility layer anyway.
* Integer sign extension bug in socket.c.Garrett D'Amore2024-10-07
| | | | | | It turns out that for now this results in early wakeups, due to another bug in the aio framework. But when that bug is fixed, this bug will lead to hangs when redialing.
* fixes #1835 setting NNG_OPT_TLS_CONFIG on socket should hold referenceGarrett D'Amore2024-07-21
|
* fixes #1827 Windows a deadlock on nng_close()Garrett D'Amore2024-05-30
|
* Logging improvements (#1816)Garrett D'Amore2024-04-21
| | | | | | | | | | | | * Add nng_str_sockaddr to get string representation of socket address. * Added nng_log_get_level() is meant to allow users to obtain the current level and avoid some possibly expensive operations just to collect debugging information when debugging is not in effect. We use a custom logger for NUTS, and this fits within the NUTS test framework well, so that if -v is supplied we get more content. All tests now get this by default.
* Log rejects by app, bind/listen/connect failures.Garrett D'Amore2024-04-14
|
* 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.
* fixes #1658 Possible use-after-free in dialerGarrett D'Amore2023-04-23
|
* fixes #1657 Use after free in listener (data race)Garrett D'Amore2023-04-23
|
* fixes #1610 nni_sock_open() in socket.c: use after freeGarrett D'Amore2023-04-19
|
* Socket close may leak messages.Garrett D'Amore2023-02-07
| | | | | | We try to move the msgq close up earler. While here we can stop dropping and reacquiring the lock -- this is likely left over and may lead to races.
* Fixes compiling when NNG_ENABLE_STATS is OFF (#1600)Ruben Valls2022-06-20
| | | The socket member `st_name` is not available when NNG_ENABLE_STATS is OFF.
* fixes #1577 nng_stat_find_socket always returns the same stats nodeGarrett D'Amore2022-04-16
| | | | | Also this fixes problems with uninitialized socket names, and the socket name stat not being adjusted correctly when set via API.
* Introduce nng_device_aio().Garrett D'Amore2021-12-27
| | | | | | This function is like nng_device(), but runs asynchronously. Also, this fixes #1503 nng_device causes nng_close to blocking
* Socket and context initialization never fails.Garrett D'Amore2021-12-25
| | | | | This makes these functions entirely bullet proof, and eliminates yet more error handling cases.
* 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.
* Fix incorrect elides of deprecated code.Garrett D'Amore2021-11-29
| | | | | | (Note that this includes some incorrect formatting due to an apparent bug in clang-format 13. Hopefully they'll fix it later, but for now I'm preserving the bad whitespace.)
* Eliminate the pipe mutex and use atomic for pipe closed.Garrett D'Amore2021-09-06
| | | | | | | | | | This eliminates several mutex operations done each time a pipe is created or destroyed. For large scale systems this should reduce overall pressure on the memory subsystem, and scale better as many threads are coming and going. This also reduces the overall size of nni_pipe -- on Linux by 36 bytes typically.
* SP initialization cannot fail.Garrett D'Amore2021-09-06
|
* fixes #1498 Endpoint close/shutdown could be synchronous (#1499)Garrett D'Amore2021-09-04
|
* Several minor cleanups. Fix socket id stat for listener.v1.5.0Garrett D'Amore2021-07-09
|
* Fix leaking pipes after close.Garrett D'Amore2021-07-07
|
* fixes #1456 bad access in OSX thread on nn (#1457)Garrett D'Amore2021-07-01
| | | | * fixes #1456 bad access in OSX thread on nn * Fix broken aio in darwin cloud.
* fixes #1372 nni_reap could be smallerGarrett D'Amore2020-12-19
|
* fixes #1071 tran_chkopt can be cleaned upGarrett D'Amore2020-11-15
| | | | | | | | | | | | | | | | | This is a sweeping cleanup of the transport logic around options, and also harmonizes the names used when setting or getting options. Additionally, legacy methods are now moved into a separate file and can be elided via CMake or a preprocessor define. Fundamentally, the ability to set to transport options via the socket is deprecated; there are numerous problems with this and my earlier approaches to deal with this have been somewhat misguided. Further these approaches will not work with future protocol work that is planned (were some options need to be negotiated with peers at the time of connection establishment.) Documentation has been updated to reflect this. The test suites still make rather broad use of the older APIs, and will be converted later.
* *Fix Add missing #define when disabling NNG_ENABLE_STATS (#1342)JaylinYu2020-11-13
| | | Co-authored-by: Jaylin <oblivionangel@sina.com>
* fixes #1323 stats framework is *way* to heavyGarrett D'Amore2020-11-11
| | | | | | This should reduce the amount of copying, and the overall size used by pipes and other objects quite a bit. (On my system, the sizeof nni_pipe shrank by 400 bytes, for example.)