aboutsummaryrefslogtreecommitdiff
path: root/src/core/dialer.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-06 19:01:12 +0300
committerGarrett D'Amore <garrett@damore.org>2018-08-06 19:01:12 +0300
commitae944a8de32c107eea9427104e153c25e4a681f1 (patch)
tree7029f7668fe3e1a9899da57bf6c1e60e0394bacb /src/core/dialer.c
parentd7f7c896c0ede24249ef63b1e45b1878bf4bd473 (diff)
downloadnng-ae944a8de32c107eea9427104e153c25e4a681f1.tar.gz
nng-ae944a8de32c107eea9427104e153c25e4a681f1.tar.bz2
nng-ae944a8de32c107eea9427104e153c25e4a681f1.zip
Revert "fixes #599 nng_dial sync should not return until added to socket"
This changeset needs work. We are seeing errors described by This reverts commit d7f7c896c0ede24249ef63b1e45b1878bf4bd473.
Diffstat (limited to 'src/core/dialer.c')
-rw-r--r--src/core/dialer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/dialer.c b/src/core/dialer.c
index 4b2f105d..34e90891 100644
--- a/src/core/dialer.c
+++ b/src/core/dialer.c
@@ -232,18 +232,24 @@ dialer_timer_cb(void *arg)
static void
dialer_connect_cb(void *arg)
{
- nni_dialer *d = arg;
+ nni_dialer *d = arg;
+ nni_pipe * p;
nni_aio * aio = d->d_con_aio;
int rv;
bool synch;
+ if ((rv = nni_aio_result(aio)) == 0) {
+ void *data = nni_aio_get_output(aio, 0);
+ NNI_ASSERT(data != NULL);
+ rv = nni_pipe_create(&p, d->d_sock, d->d_tran, data);
+ }
nni_mtx_lock(&d->d_mtx);
synch = d->d_synch;
nni_mtx_unlock(&d->d_mtx);
- switch ((rv = nni_aio_result(aio))) {
+ switch (rv) {
case 0:
- nni_dialer_add_pipe(d, nni_aio_get_output(aio, 0));
+ nni_dialer_add_pipe(d, p);
break;
case NNG_ECLOSED: // No further action.
case NNG_ECANCELED: // No further action.