aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.c
Commit message (Collapse)AuthorAge
* Windows fixes; especially idempotent init/fini.Garrett D'Amore2017-08-11
| | | | | | | This fixes one major problem, which was that if nni_fini() was called once on Windows, it would not be further possible to call nni_init(). While here fixed a few compilation issues.
* Unify the msg API.Garrett D'Amore2017-08-10
| | | | | | | | | | | | | This makes the operations that work on headers start with nni_msg_header or nng_msg_header. It also renames _trunc to _chop (same strlen as _trim), and renames prepend to insert. We add a shorthand for clearing message content, and make better use of the endian safe 32-bit accessors too. This also fixes a bug in inserting large headers into messages. A test suite for message handling is included.
* fixes #47 compat_reqttls fails sometimesGarrett D'Amore2017-08-09
| | | | fixes #23 Restore the old idhash logic for sockets
* Fix problems found in Windows build.Garrett D'Amore2017-08-09
|
* fixes #44 open protocol by "name" (symbol) instead numberGarrett D'Amore2017-08-09
| | | | | | | | | | | | | | fixes #38 Make protocols "pluggable", or at least optional This is a breaking change, as we've done away with the central registered list of protocols, and instead demand the user call nng_xxx_open() where xxx is a protocol name. (We did keep a table around in the compat framework though.) There is a nice way for protocols to plug in via an nni_proto_open(), where they can use a generic constructor that they use to build a protocol specific constructor (passing their ops vector in.)
* Added nn_compat code for option handling, fixed other bugs.Garrett D'Amore2017-08-08
| | | | | | | Hop counts for REQ were busted (bad TTL), and imported the compat_reqtll test. At the same time, added code to nn_term to shut down completely, discarding sockets. (Note that some things, such as globals, may still be left around; that's ok.)
* Don't clear the AIO provider data in finish.Garrett D'Amore2017-08-07
| | | | | | The finish routine can race against an asynchronous cancellation, so we must not clear the data pointer, or we can wind up with a NULL pointer dereference.
* We use NNG_ETIMEDOUT from msgq now.Garrett D'Amore2017-08-07
|
* Lets hold the lock a little while longer.Garrett D'Amore2017-07-20
|
* Yet more race condition fixes.Garrett D'Amore2017-07-20
| | | | | | | | | We need to remember that protocol stops can run synchronously, and therefore we need to wait for the aio to complete. Further, we need to break apart shutting down aio activity from deallocation, as we need to shut down *all* async activity before deallocating *anything*. Noticed that we had a pipe race in the surveyor pattern too.
* Fix close-related leak of pipes.Garrett D'Amore2017-07-18
| | | | | | | | | | | We have seen leaks of pipes causing test failures (e.g. the Windows IPC test) due to EADDRINUSE. This was caused by a case where we failed to pass the pipe up because the AIO had already been canceled, and we didn't realize that we had oprhaned the pipe. The fix is to add a return value to nni_aio_finish, and verify that we did finish properly, or if we did not then we must free the pipe ourself. (The zero return from nni_aio_finish indicates that it accepts ownership of resources passed via the aio.)
* Fix hang on double-close of socket.Garrett D'Amore2017-07-17
|
* Ditch unused nni_sock_hold() call.Garrett D'Amore2017-07-17
|
* Bind the pipe to the ep properly, and wake any closers needed.Garrett D'Amore2017-07-16
|
* 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.
* Some initial progress on *connect* async.Garrett D'Amore2017-07-15
| | | | | | This actually is breaking at the moment, because we don't have good integration with timeouts, and there are some frustrating races with timeouts at points that can cause apparent hangs.
* Implemented asynchronous (fully) accept.Garrett D'Amore2017-07-14
| | | | | | This logic leaves a race condition in the dial side, which will be fixed with a subsequent change to convert that to fully asynchronous as well.
* Attempts to minimize races, remove unused nni_sock_mtx function.Garrett D'Amore2017-07-12
| | | | | | We still have endpoint related races apparently; we need to examine the possibility of handling endpoints much like we do pipes, which seem to be race free.
* Give up on uncrustify; switch to clang-format.Garrett D'Amore2017-07-10
|
* SRWLocks FTW!Garrett D'Amore2017-07-07
| | | | | | | | | Modern Windows (Vista and later) have light weight Slim Read/Write locks which only occupy 64 bits, and don't require any memory allocation to create. While here clean up a few more unreferenced variables found with the Microsoft compilers.
* TCP asynchronous working now.Garrett D'Amore2017-07-07
| | | | | | | | | | | | | | | | It turns out that I had to fix a number of subtle asynchronous handling bugs, but now TCP is fully asynchronous. We need to change the high-level dial and listen interfaces to be async as well. Some of the transport APIs have changed here, and I've elected to change what we expose to consumers as endpoints into seperate dialers and listeners. Under the hood they are the same, but it turns out that its helpful to know the intended use of the endpoint at initialization time. Scalability still occasionally hangs on Linux. Investigation pending.
* Use common aio cancellation.Garrett D'Amore2017-07-02
|
* Refactor stop again, closing numerous races (thanks valgrind!)Garrett D'Amore2017-06-28
|
* Fix a few race condition panics.Garrett D'Amore2017-06-25
|
* Protocols keep their own reference counts.Garrett D'Amore2017-06-24
|
* Start undoing the recursive references -- KISS.Garrett D'Amore2017-06-22
|
* Don't acquire the lock if the endpoint isn't on a list.Garrett D'Amore2017-06-22
|
* Make APIs for holding references more consistent.Garrett D'Amore2017-06-21
|
* Endpoint close can be moved later; add check for closed in pipe_add.Garrett D'Amore2017-06-09
|
* Eliminate idle pipe list (unused).Garrett D'Amore2017-06-09
|
* Pipes are now mostly using object hash -- taskq_cancel race TBD.Garrett D'Amore2017-06-08
|
* Reconn times acquired atomically by socket under lock.Garrett D'Amore2017-06-06
|
* Endpoint now holds a reference on the socket.Garrett D'Amore2017-06-06
|
* Make objhash fini calls idempotent.Garrett D'Amore2017-06-06
|
* New object hash implementation, used by socket (to start).Garrett D'Amore2017-06-05
|
* More cleanups. Delete unused call, isolate ep list creation.Garrett D'Amore2017-03-19
|
* Eliminate p_active, better names for pipe start and stop.Garrett D'Amore2017-03-19
|
* Reduce socket/pipe private data coupling.Garrett D'Amore2017-03-19
|
* Notification working - separate thread now.Garrett D'Amore2017-03-11
|
* Eliminate per-socket workers.Garrett D'Amore2017-03-10
|
* Good-bye reaper thread.Garrett D'Amore2017-03-10
|
* Start of close related race fixes. Scalability test.Garrett D'Amore2017-03-10
|
* Pipeline protocol now entirely callback driven.Garrett D'Amore2017-03-04
|
* Add device support & testing. Bus semantic fix.Garrett D'Amore2017-01-27
| | | | | | | | | | | This adds nn_device and nng_device. There were some internal changes required to fix shutdown / close issues. Note that we shut down the sockets when exiting from device -- this is required to make both threads see the failure and bail, since we are not using a single event loop. I also noticed that the bus protocol had a bug where it would send messages back to the originator. This was specifically tested for in the compat_device test, and we have fixed it.
* Add endpoint tuning of maxrcv size. Fix cmsg API.Garrett D'Amore2017-01-24
| | | | | | | | | | | | | | The CMSG handling was completely borked. This is fixed now, and we stash the SP header size (ugh) in the CMSG contents to match what nanomsg does. We now pass the cmsg validation test. We also fixed handling of certain endpoint-related options, so that endpoints can get options from the socket at initialization time. This required a minor change to the transport API for endpoints. Finally, we fixed a critical fault in the REP handling of RAW sockets, which caused them to always return NNG_ESTATE in all cases. It should now honor the actual socket option.
* Implement reconnect timer including backoff.Garrett D'Amore2017-01-24
| | | | This allows us to enable the last test case for compat_reqrep.
* Initial start of compat layer with bind, connect, etc. Untested.Garrett D'Amore2017-01-22
|
* Event notification via pollable FDs verified working.Garrett D'Amore2017-01-22
|
* Adds NNG_OPT_SENDFD and NNG_OPT_RECVFD socket options (untested).Garrett D'Amore2017-01-21
|
* 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.)