Revert "oblige the application to explicitely set the node type for PLAIN"

This reverts commit 1206f4572b.
This commit is contained in:
Pieter Hintjens
2013-09-17 14:05:41 +02:00
parent 9e66685c08
commit 22eb4d600b
4 changed files with 16 additions and 17 deletions

View File

@@ -275,10 +275,10 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
break;
case ZMQ_PLAIN_NODE:
if (is_int && (value == ZMQ_CLIENT || value == ZMQ_SERVER)) {
case ZMQ_PLAIN_SERVER:
if (is_int && (value == 0 || value == 1)) {
as_server = value;
mechanism = ZMQ_PLAIN;
mechanism = value? ZMQ_PLAIN: ZMQ_NULL;
return 0;
}
break;
@@ -291,6 +291,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
else
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
plain_username.assign ((const char *) optval_, optvallen_);
as_server = 0;
mechanism = ZMQ_PLAIN;
return 0;
}
@@ -304,6 +305,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
else
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
plain_password.assign ((const char *) optval_, optvallen_);
as_server = 0;
mechanism = ZMQ_PLAIN;
return 0;
}
@@ -318,7 +320,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
// If libsodium isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM
case ZMQ_CURVE_NODE:
case ZMQ_CURVE_SERVER:
if (is_int && (value == ZMQ_CLIENT || value == ZMQ_SERVER)) {
as_server = value;
mechanism = ZMQ_CURVE;
@@ -540,9 +542,9 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break;
case ZMQ_PLAIN_NODE:
case ZMQ_PLAIN_SERVER:
if (is_int) {
*value = as_server;
*value = as_server && mechanism == ZMQ_PLAIN;
return 0;
}
break;
@@ -573,7 +575,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
// If libsodium isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM
case ZMQ_CURVE_NODE:
case ZMQ_CURVE_SERVER:
if (is_int) {
*value = as_server;
return 0;