summaryrefslogtreecommitdiff
path: root/src/platform
Commit message (Collapse)AuthorAge
* kqueue: add kqueue-based pollq implementationLiam Staskawicz2018-03-02
|
* Windows IPC connection timer still thinks its usec.Garrett D'Amore2018-02-26
| | | | | | We changed the timers to use msec granularity, but we missed this one. The result is that in certain code flows the IPC connection times can look quite long -- with weird 10 sec stalls.
* Hang in concurrent IPC connection close.Garrett D'Amore2018-02-26
| | | | | | ConnectNamedPipe can return ERROR_PIPE_CONNECTED, and does not enqueue a completion packet if it does. So we need to handle that specially.
* Fixes for POSIX pollq structure.Garrett D'Amore2018-02-21
| | | | | | | | | | | | | | It was possible for pollq arm to be called on a node that was removed in some circumstances -- particularly and ep that was closed in the callback. While here, lets use normal booleans for closed state, and only call the arm function (which is not free -- typicall it involves a mutex and may even involve a system call) if we are going to arm some events. We also initialize these things properly, and clean up a stale comment. This work is done to faciliate the kqueue work by @liamstask.
* Simply posix pollq architecture somewhat.Garrett D'Amore2018-02-15
| | | | | | | | | | This change is being made to facilitate the work done for the kqueue port. We have created two new functions, nni_posix_pollq_init and nni_posix_pollq_fini, which can be used when creating or destroying the pollq nodes. Then nodes are *added* and *removed* from the pollq structure with nni_posix_pollq_add and nni_posix_pollq_remove. The add function in particular MUST NEVER be called unless the node has a valid file descriptor.
* fixes #234 Investigate enabling more verbose compiler warningsGarrett D'Amore2018-02-14
| | | | | | | We enabled verbose compiler warnings, and found a lot of issues. Some of these were even real bugs. As a bonus, we actually save some initialization steps in the compat layer, and avoid passing some variables we don't need.
* Backout #224 Does not work in CI, and breaks legacy compatibility.Garrett D'Amore2018-02-08
| | | | | | | It turns out that at least on some systems, the CreateNamedPipeW does not behave as we'd expect. Furthermore, using the Unicode variants seems have a negative impact on compatibility with legacy nanomsg.
* fixes #171 Refactor aio to use generic data fieldsGarrett D'Amore2018-02-08
| | | | | | | | This addresses the use of the pipe special field, and eliminates it. The message APIs (recvmsg, sendmsg) need to be updated as well still, but I want to handle that as part of a separate issue. While here we fixed various compiler warnings, etc.
* fixes #224 Windows pipe name restrictions, unicodeGarrett D'Amore2018-02-07
| | | | While here, we cleaned up a few other unused variables in the HTTP code.
* fixes #228 aio iov should have larger limits (dynamically allocated)Garrett D'Amore2018-02-05
|
* fixes #173 Define public HTTP server APIGarrett D'Amore2018-02-01
| | | | | | | | | | | | | | | | | | | | | | | This introduces enough of the HTTP API to support fully server applications, including creation of websocket style protocols, pluggable handlers, and so forth. We have also introduced scatter/gather I/O (rudimentary) for aios, and made other enhancements to the AIO framework. The internals of the AIOs themselves are now fully private, and we have eliminated the aio->a_addr member, with plans to remove the pipe and possibly message members as well. A few other minor issues were found and fixed as well. The HTTP API includes request, response, and connection objects, which can be used with both servers and clients. It also defines the HTTP server and handler objects, which support server applications. Support for client applications will require a client object to be exposed, and that should be happening shortly. None of this is "documented" yet, bug again, we will follow up shortly.
* fixes #216 HTTP server side API refactoring, directory serving supportGarrett D'Amore2018-01-20
| | | | | | | | | | | This changes the backend (internal) HTTP API to provide a much more sensible handler scheme, where the handlers are opaque objects and we can allocate a handler for different types of tasks. We've also added support serving up directories of static content, and added code to validate that the directory serving is working as intended. This is a key enabling step towards the public API.
* fixes #206 Want NNG_OPT_TLS_VERIFIED optionGarrett D'Amore2018-01-16
| | | | | | | | | | | | | | It is useful to have support for validating that a peer *was* verified, especially in the presence of optional validation. We have added a property that does this, NNG_OPT_TLS_VERIFIED. Further, all the old NNG_OPT_WSS_TLS_* property names have also been renamed to generic NNG_OPT_TLS property names, which have been moved to nng.h to facilitate reuse and sharing, with the comments moved and corrected as well. Finally, the man pages have been updated, with substantial improvements to the nng_ws man page in particular.
* Refactored file API.Garrett D'Amore2018-01-11
| | | | | | | | | This refactor of the file API provides a simpler and easier to use interface for our needs (and simpler to implement) in both the ZeroTier transport and the HTTP/TLS file accesses. It also removes some restrictions present on the old one, although it is still not suitable for working with large files. (It will work, just be very inefficient as the entire file must be loaded into memory.)
* Compile warning (possible size_t overrun) on Windows.Garrett D'Amore2017-12-28
|
* fixes #158 nni_plat_init: undefined return value if called from two threadsGarrett D'Amore2017-12-28
|
* Fix compilation warnings, bugs, and crashes found on Windows.Garrett D'Amore2017-12-28
| | | | | This addresses a number of problems that were found on Windows, including one bug that actually turned up in testing on POSIX.
* 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.
* fixes #154 underlyng TCP & IPC transports should support partial recv/sendGarrett D'Amore2017-11-13
| | | | fixes #155 POSIX TCP & IPC could avoid a lot of context switches
* fixes #150 IPC error during Bus testsGarrett D'Amore2017-11-05
|
* Darwin needs to use SO_NOSIGPIPE.Garrett D'Amore2017-11-04
|
* Simplify pollq_add, use SO_NOSIGNAL option on macOS.Garrett D'Amore2017-10-30
|
* And another compile time regression.Garrett D'Amore2017-10-19
|
* POSIX fixups for certain platforms.Garrett D'Amore2017-10-19
|
* fixes #84 Consider using msec for durationsGarrett D'Amore2017-10-19
| | | | | | There is now a public nng_duration type. We have also updated the zerotier work to work with the signed int64_t's that the latst ZeroTier dev branch is using.
* New platform API for storage methods.Garrett D'Amore2017-10-09
| | | | | | | | | | | This includes converting the ZeroTier transport to use these. The new API supports file creation, retrieval, and deletion. It also supports directory methods for traversal, creation, and deletion. It also has a few methods to obtain well-known directories like $TMPDIR and $HOME. A rich test suite for this functionality is added as well.
* Improve UDP test coverage, fix numerous issues found.Garrett D'Amore2017-10-05
| | | | | | | | | | | | | | | | We introduced richer, deeper tests for UDP functionality. These tests uncovered a number of issues which this commit fixes. The Windows IOCP code needs to support multiple aios on a single nni_win_event. A redesign of the IOCP handling addresses that. The POSIX UDP code also needed fixes; foremost among them is the fact that the UDP file descriptor is not placed into non-blocking mode, leading to potential hangs. A number of race conditions and bugs along the implementation of the above items were uncovered and fixed. To the best of our knowledge the current code is bug-free.
* fixes #5 Address propertiesGarrett D'Amore2017-10-03
| | | | | | | | | Added TCP socket address properties on pipes. This adds the plumbing for the various platform specifics, and includes both v4 and v6 handling. We've included a TCPv6 test as well.
* Windows UDP support.Garrett D'Amore2017-09-29
| | | | | | | This implements the basic UDP functionality for Windows (required for ZeroTier for example). We have also introduced a UDP test suite to validate that this actually works. While here a few Windows compilation warnings / nits were fixed.
* ZeroTier transport implementation (work funded by Capitar IT Group BV)Garrett D'Amore2017-09-26
| | | | | | | | | | | | | The ZeroTier transport is experimental at this point, and not enabled by default. It does not work with Windows yet (the Windows platform needs UDP support first.) Configure with -DNNG_ENABLE_ZEROTIER=yes -DNNG_ZEROTIER_SOUCE=<path> The <path> must point to a dev branch of the ZeroTierOne source tree, checked out, and built with a libzerotiercore.a in the top directory, and a ZeroTierOne.h header located at include. The build will add -lc++ to the compile, as the ZeroTier core functionality is written in C++ and needs some runtime support (e.g. new, delete, etc.)
* Fix bugs in UDP layer.Garrett D'Amore2017-09-05
|
* Introduce utility safe string handling functions.Garrett D'Amore2017-08-28
| | | | | | | | We have our versions of strdup, strlcat, and strlcpy. This means we can avoid using snprintf() in many cases (saving cycles), and we can get safer checks. We use the platform supplied versions of these if they exist (wrapping with nni_xxx versions.)
* Validate that we do not overrun sun_path in sockaddr_un.Garrett D'Amore2017-08-21
|
* fixes #41 Move DNS out of tcp transportGarrett D'Amore2017-08-21
| | | | | | | | | This moves the DNS related functionality into common code, and also removes all the URL parsing stuff out of the platform specific code and into the transports. Now the transports just take sockaddr's on initialization. (We may want to move this until later.) We also add UDP resolution as another separate API.
* Conditional platform inclusion cleanups.Garrett D'Amore2017-08-21
| | | | | | | | | | We only compile files that are appropriate for the platform. (We still have guards in place, to allow for a future single .C file to be built from all the sources.) We also remove the subsystem defines; if a new platform needs to deviate from POSIX in ways beyond what we intended here, then that platform should just copy those parts into a new platform directory, rather than cross including portions from POSIX.
* Add new errnos we might need.Garrett D'Amore2017-08-18
|
* 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.
* Fix a few problems found by codacy. One was a real bug.Garrett D'Amore2017-08-14
|
* 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.
* Posix pollq fini is not properly idempotent.Garrett D'Amore2017-08-11
| | | | | This creates a use-after-free bug if nni_fini() is run, then new sockets are created.
* Thundering herd kills performance.Garrett D'Amore2017-08-10
| | | | | | | | | | | | | | A little benchmarking showed that we were encountering far too many wakeups, leading to severe performance degradation; we had a bunch of threads all sleeping on the same condition variable (taskqs) and this woke them all up, resulting in heavy mutex contention. Since we only need one of the threads to wake, and we don't care which one, let's just wake only one. This reduced RTT latency from about 240 us down to about 30 s. (1/8 of the former cost.) There's still a bunch of tuning to do; performance remains worse than we would like.
* Fix a few pointer vs. character errors found by gcc 7.Garrett D'Amore2017-08-07
|
* Fix warninsg about size types found in 64-bit windows build.Garrett D'Amore2017-08-05
|
* COnvert UDP to new style.Garrett D'Amore2017-08-04
|
* Refactor AIO logic to close numerous races and reduce complexity.Garrett D'Amore2017-08-04
| | | | | | | | | This passes valgrind 100% clean for both helgrind and deep leak checks. This represents a complete rethink of how the AIOs work, and much simpler synchronization; the provider API is a bit simpler to boot, as a number of failure modes have been simply eliminated. While here a few other minor bugs were squashed.
* Initial swag at UDP (POSIX only) low level handling.Garrett D'Amore2017-07-25
| | | | | | This includes async send and recv, driven from the poller. This will be requierd to support the underlying UDP and ZeroTier transports in the future. (ZeroTier is getting done first.)
* Update Capitar copyrights.Garrett D'Amore2017-07-21
|
* Simpler taskq API.Garrett D'Amore2017-07-21
| | | | | | | The queue is bound at initialization time of the task, and we call entries just tasks, so we don't have to pass around a taskq pointer across all the calls. Further, nni_task_dispatch is now guaranteed to succeed.
* 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.
* Fixes most of the raaces in posix; but at least one remains outstanding.Garrett D'Amore2017-07-18
| | | | | | Apparently there are circumstances when a pipedesc may get orphaned form the pollq. This triggers an assertion failure when it occurs. I am still trying to understand how this can occur. Stay tuned.