diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-16 16:27:22 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-16 16:27:22 -0800 |
| commit | ac8415c24ffea645105c3859e814843e81c97f8a (patch) | |
| tree | 7b64b4aab3de6ce5bdd69c3d5b7ead57f4a4b4e7 /src/protocol/pipeline | |
| parent | b8f7236aa2928d70d9bff2e1071654982539eeda (diff) | |
| download | nng-ac8415c24ffea645105c3859e814843e81c97f8a.tar.gz nng-ac8415c24ffea645105c3859e814843e81c97f8a.tar.bz2 nng-ac8415c24ffea645105c3859e814843e81c97f8a.zip | |
Start of event framework.
This compiles correctly, but doesn't actually deliver events yet.
As part of this, I've made most of the initializables in nng
safe to tear-down if uninitialized (or set to zero e.g. via calloc).
This makes it loads easier to write the teardown on error code, since
I can deinit everything, without worrying about which things have been
initialized and which have not.
Diffstat (limited to 'src/protocol/pipeline')
| -rw-r--r-- | src/protocol/pipeline/pull.c | 8 | ||||
| -rw-r--r-- | src/protocol/pipeline/push.c | 12 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c index 20beb873..ca15efef 100644 --- a/src/protocol/pipeline/pull.c +++ b/src/protocol/pipeline/pull.c @@ -50,7 +50,9 @@ nni_pull_sock_fini(void *arg) { nni_pull_sock *pull = arg; - NNI_FREE_STRUCT(pull); + if (pull != NULL) { + NNI_FREE_STRUCT(pull); + } } @@ -74,7 +76,9 @@ nni_pull_pipe_fini(void *arg) { nni_pull_pipe *pp = arg; - NNI_FREE_STRUCT(pp); + if (pp != NULL) { + NNI_FREE_STRUCT(pp); + } } diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c index 4704a323..0f973f8a 100644 --- a/src/protocol/pipeline/push.c +++ b/src/protocol/pipeline/push.c @@ -84,8 +84,10 @@ nni_push_sock_fini(void *arg) { nni_push_sock *push = arg; - nni_cv_fini(&push->cv); - NNI_FREE_STRUCT(push); + if (push != NULL) { + nni_cv_fini(&push->cv); + NNI_FREE_STRUCT(push); + } } @@ -116,8 +118,10 @@ nni_push_pipe_fini(void *arg) { nni_push_pipe *pp = arg; - nni_msgq_fini(pp->mq); - NNI_FREE_STRUCT(pp); + if (pp != NULL) { + nni_msgq_fini(pp->mq); + NNI_FREE_STRUCT(pp); + } } |
