Commit 8c0ded50 authored by Pieter Hintjens's avatar Pieter Hintjens

Properly set mechanism to CURVE when setting a curve option

parent 10f69c15
...@@ -296,6 +296,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -296,6 +296,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
case ZMQ_CURVE_PUBLICKEY: case ZMQ_CURVE_PUBLICKEY:
if (optvallen_ == CURVE_KEYSIZE) { if (optvallen_ == CURVE_KEYSIZE) {
memcpy (curve_public_key, optval_, CURVE_KEYSIZE); memcpy (curve_public_key, optval_, CURVE_KEYSIZE);
mechanism = ZMQ_CURVE;
return 0; return 0;
} }
break; break;
...@@ -303,6 +304,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -303,6 +304,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
case ZMQ_CURVE_SECRETKEY: case ZMQ_CURVE_SECRETKEY:
if (optvallen_ == CURVE_KEYSIZE) { if (optvallen_ == CURVE_KEYSIZE) {
memcpy (curve_secret_key, optval_, CURVE_KEYSIZE); memcpy (curve_secret_key, optval_, CURVE_KEYSIZE);
mechanism = ZMQ_CURVE;
return 0; return 0;
} }
break; break;
...@@ -310,6 +312,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -310,6 +312,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
case ZMQ_CURVE_SERVERKEY: case ZMQ_CURVE_SERVERKEY:
if (optvallen_ == CURVE_KEYSIZE) { if (optvallen_ == CURVE_KEYSIZE) {
memcpy (curve_server_key, optval_, CURVE_KEYSIZE); memcpy (curve_server_key, optval_, CURVE_KEYSIZE);
as_server = 0;
mechanism = ZMQ_CURVE;
return 0; return 0;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment