Fixed issues #337, #341, and #340

* Implemented new ctx API (_new, _destroy, _get, _set)
* Removed 'typesafe' macros from zmq.h
* Added support for MAX_SOCKETS (was tied into change for #337)
* Created new man pages
This commit is contained in:
Pieter Hintjens
2012-03-19 19:41:20 -05:00
parent bdefa181ed
commit 6e71a54b1e
39 changed files with 798 additions and 196 deletions

View File

@@ -75,43 +75,43 @@ bool zmq::socket_base_t::check_tag ()
}
zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
uint32_t tid_)
uint32_t tid_, int sid_)
{
socket_base_t *s = NULL;
switch (type_) {
case ZMQ_PAIR:
s = new (std::nothrow) pair_t (parent_, tid_);
s = new (std::nothrow) pair_t (parent_, tid_, sid_);
break;
case ZMQ_PUB:
s = new (std::nothrow) pub_t (parent_, tid_);
s = new (std::nothrow) pub_t (parent_, tid_, sid_);
break;
case ZMQ_SUB:
s = new (std::nothrow) sub_t (parent_, tid_);
s = new (std::nothrow) sub_t (parent_, tid_, sid_);
break;
case ZMQ_REQ:
s = new (std::nothrow) req_t (parent_, tid_);
s = new (std::nothrow) req_t (parent_, tid_, sid_);
break;
case ZMQ_REP:
s = new (std::nothrow) rep_t (parent_, tid_);
s = new (std::nothrow) rep_t (parent_, tid_, sid_);
break;
case ZMQ_XREQ:
s = new (std::nothrow) xreq_t (parent_, tid_);
s = new (std::nothrow) xreq_t (parent_, tid_, sid_);
break;
case ZMQ_XREP:
s = new (std::nothrow) xrep_t (parent_, tid_);
s = new (std::nothrow) xrep_t (parent_, tid_, sid_);
break;
case ZMQ_PULL:
s = new (std::nothrow) pull_t (parent_, tid_);
s = new (std::nothrow) pull_t (parent_, tid_, sid_);
break;
case ZMQ_PUSH:
s = new (std::nothrow) push_t (parent_, tid_);
s = new (std::nothrow) push_t (parent_, tid_, sid_);
break;
case ZMQ_XPUB:
s = new (std::nothrow) xpub_t (parent_, tid_);
s = new (std::nothrow) xpub_t (parent_, tid_, sid_);
break;
case ZMQ_XSUB:
s = new (std::nothrow) xsub_t (parent_, tid_);
s = new (std::nothrow) xsub_t (parent_, tid_, sid_);
break;
default:
errno = EINVAL;
@@ -121,7 +121,7 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
return s;
}
zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_) :
zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
own_t (parent_, tid_),
tag (0xbaddecaf),
ctx_terminated (false),
@@ -130,6 +130,7 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_) :
ticks (0),
rcvmore (false)
{
options.socket_id = sid_;
}
zmq::socket_base_t::~socket_base_t ()