From fe2c07b6a0dced827b7e086b39b1908d1861af39 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Aug 2017 19:10:09 -0700 Subject: Add some more compatibility tests; fix surveyor compat bug. We noticed a bug in the surveyor handling of the options; this fixes that. At the same time, we noticed a race condition in the setting of the error for future calls, a short sleep seems to cure it. This distinction (ESTATE vs ETIMEDOUT) is pretty annoying, and it would be better to have a different way to handle it. More work here is warranted. --- src/nng_compat.c | 3 ++- src/nng_compat.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nng_compat.c b/src/nng_compat.c index 9515dc31..160fd33d 100644 --- a/src/nng_compat.c +++ b/src/nng_compat.c @@ -622,7 +622,7 @@ nn_setsockopt(int s, int nnlevel, int nnopt, const void *valp, size_t sz) break; case NN_SURVEYOR: switch (nnopt) { - case NN_SURVEY_DEADLINE: + case NN_SURVEYOR_DEADLINE: opt = NNG_OPT_SURVEYTIME; mscvt = 1; break; @@ -630,6 +630,7 @@ nn_setsockopt(int s, int nnlevel, int nnopt, const void *valp, size_t sz) errno = ENOPROTOOPT; return (-1); } + break; default: errno = ENOPROTOOPT; return (-1); diff --git a/src/nng_compat.h b/src/nng_compat.h index cd189b2d..e83c20b8 100644 --- a/src/nng_compat.h +++ b/src/nng_compat.h @@ -1,5 +1,6 @@ // // Copyright 2017 Garrett D'Amore +// Copyright 2017 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -218,7 +219,7 @@ extern "C" { #define NN_SUB_SUBSCRIBE (NN_SUB * 16 + 1) #define NN_SUB_UNSUBSCRIBE (NN_SUB * 16 + 2) #define NN_REQ_RESEND_IVL (NN_REQ * 16 + 1) -#define NN_SURVEY_DEADLINE (NN_SURVEYOR * 16 + 1) +#define NN_SURVEYOR_DEADLINE (NN_SURVEYOR * 16 + 1) // Level options for tranports #define NN_INPROC (-1) -- cgit v1.2.3-70-g09d2