From ff791199733ee69ca41fd0e1e567cc07e4b2f07f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 14 Dec 2016 11:38:04 -0800 Subject: Oops... Pipe list initialization was not complete. --- src/CMakeLists.txt | 1 + src/core/nng_impl.h | 1 + src/core/pipe.c | 13 +++++++++++++ src/core/socket.c | 10 ++++++++-- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad9a8a0d..96e83e28 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,7 @@ set (NNG_SOURCES core/panic.c core/panic.h core/pipe.c + core/pipe.h core/platform.c core/platform.h core/protocol.c diff --git a/src/core/nng_impl.h b/src/core/nng_impl.h index beae4056..6890c7c8 100644 --- a/src/core/nng_impl.h +++ b/src/core/nng_impl.h @@ -42,6 +42,7 @@ #include "core/list.h" #include "core/msgqueue.h" #include "core/panic.h" +#include "core/pipe.h" #include "core/snprintf.h" #include "core/platform.h" #include "core/protocol.h" diff --git a/src/core/pipe.c b/src/core/pipe.c index 40a810c8..5e867406 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -72,4 +72,17 @@ uint16_t nni_pipe_peer(nng_pipe_t p) { return (p->p_ops.p_peer(p->p_tran)); +} + +void +nni_pipe_destroy(nng_pipe_t p) +{ + p->p_ops.p_destroy(p->p_tran); + nni_free(p, sizeof (*p)); +} + +void +nni_pipe_list_init(nni_list_t *list) +{ + NNI_LIST_INIT(list, struct nng_pipe, p_node); } \ No newline at end of file diff --git a/src/core/socket.c b/src/core/socket.c index aeebdf25..d48f2b86 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -35,9 +35,11 @@ struct nng_socket { struct nni_protocol s_ops; void *s_data; /* Protocol private. */ + /* options */ - /* pipes */ - /* endpoints */ + + nni_list_t s_eps; + nni_list_t s_pipes; int s_besteffort; /* Best effort mode delivery. */ int s_senderr; /* Protocol state machine use. */ @@ -73,6 +75,10 @@ nng_socket_create(nng_socket_t *sockp, uint16_t proto) return (NNG_ENOMEM); } sock->s_ops = *ops; + + nni_pipe_list_init(&sock->s_pipes); + //NNI_LIST_INIT(&sock->s_eps, nng_endpt_t, ep_node); + if ((rv = sock->s_ops.proto_create(&sock->s_data, sock)) != 0) { nni_free(sock, sizeof (*sock)); return (rv); -- cgit v1.2.3-70-g09d2