From 93db6fe3aaff421d61a15993ba6827b742ab00d1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 27 Nov 2017 14:21:20 -0800 Subject: fixes #2 Websocket transport 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. --- src/platform/posix/posix_tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/platform') diff --git a/src/platform/posix/posix_tcp.c b/src/platform/posix/posix_tcp.c index e03f8056..69d7e7ce 100644 --- a/src/platform/posix/posix_tcp.c +++ b/src/platform/posix/posix_tcp.c @@ -38,11 +38,11 @@ nni_plat_tcp_ep_init(nni_plat_tcp_ep **epp, const nni_sockaddr *lsa, return (rv); } - if (rsa->s_un.s_family != NNG_AF_UNSPEC) { + if ((rsa != NULL) && (rsa->s_un.s_family != NNG_AF_UNSPEC)) { len = nni_posix_nn2sockaddr((void *) &ss, rsa); nni_posix_epdesc_set_remote(ed, &ss, len); } - if (lsa->s_un.s_family != NNG_AF_UNSPEC) { + if ((lsa != NULL) && (lsa->s_un.s_family != NNG_AF_UNSPEC)) { len = nni_posix_nn2sockaddr((void *) &ss, lsa); nni_posix_epdesc_set_local(ed, &ss, len); } -- cgit v1.2.3-70-g09d2