2009-08-08 16:01:58 +02:00
|
|
|
/*
|
2010-01-05 08:29:35 +01:00
|
|
|
Copyright (c) 2007-2010 iMatix Corporation
|
2009-08-08 16:01:58 +02:00
|
|
|
|
|
|
|
This file is part of 0MQ.
|
|
|
|
|
|
|
|
0MQ is free software; you can redistribute it and/or modify it under
|
2010-10-30 15:08:28 +02:00
|
|
|
the terms of the GNU Lesser General Public License as published by
|
2009-08-08 16:01:58 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
0MQ is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-10-30 15:08:28 +02:00
|
|
|
GNU Lesser General Public License for more details.
|
2009-08-08 16:01:58 +02:00
|
|
|
|
2010-10-30 15:08:28 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2009-08-08 16:01:58 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-12-15 23:49:55 +01:00
|
|
|
#include <new>
|
2009-08-21 14:29:22 +02:00
|
|
|
#include <string>
|
2009-08-08 16:01:58 +02:00
|
|
|
#include <algorithm>
|
|
|
|
|
2010-03-11 20:33:27 +01:00
|
|
|
#include "../include/zmq.h"
|
2009-08-08 16:01:58 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
#include "platform.hpp"
|
|
|
|
|
|
|
|
#if defined ZMQ_HAVE_WINDOWS
|
|
|
|
#include "windows.hpp"
|
|
|
|
#if defined _MSC_VER
|
|
|
|
#include <intrin.h>
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2010-05-05 14:24:54 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
#include "socket_base.hpp"
|
2009-08-08 16:01:58 +02:00
|
|
|
#include "zmq_listener.hpp"
|
2009-08-09 16:12:09 +02:00
|
|
|
#include "zmq_connecter.hpp"
|
2009-08-08 16:01:58 +02:00
|
|
|
#include "io_thread.hpp"
|
2010-08-11 14:09:56 +02:00
|
|
|
#include "connect_session.hpp"
|
2009-08-09 11:57:21 +02:00
|
|
|
#include "config.hpp"
|
2010-09-26 16:55:54 +02:00
|
|
|
#include "clock.hpp"
|
2009-08-27 10:54:28 +02:00
|
|
|
#include "pipe.hpp"
|
2009-09-04 16:02:41 +02:00
|
|
|
#include "err.hpp"
|
2010-05-05 14:24:54 +02:00
|
|
|
#include "ctx.hpp"
|
2009-09-11 17:58:37 +02:00
|
|
|
#include "platform.hpp"
|
2010-04-11 16:36:27 +02:00
|
|
|
#include "likely.hpp"
|
2010-12-04 23:14:38 +01:00
|
|
|
#include "uuid.hpp"
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
#include "pair.hpp"
|
|
|
|
#include "pub.hpp"
|
|
|
|
#include "sub.hpp"
|
|
|
|
#include "req.hpp"
|
|
|
|
#include "rep.hpp"
|
|
|
|
#include "pull.hpp"
|
|
|
|
#include "push.hpp"
|
|
|
|
#include "xreq.hpp"
|
|
|
|
#include "xrep.hpp"
|
2010-12-04 23:14:38 +01:00
|
|
|
#include "xpub.hpp"
|
|
|
|
#include "xsub.hpp"
|
2009-08-08 16:01:58 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
|
2010-11-05 16:38:52 +01:00
|
|
|
uint32_t tid_)
|
2010-08-06 17:49:37 +02:00
|
|
|
{
|
|
|
|
socket_base_t *s = NULL;
|
|
|
|
switch (type_) {
|
|
|
|
|
|
|
|
case ZMQ_PAIR:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) pair_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_PUB:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) pub_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_SUB:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) sub_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_REQ:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) req_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_REP:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) rep_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_XREQ:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) xreq_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_XREP:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) xrep_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_PULL:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) pull_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
|
|
|
case ZMQ_PUSH:
|
2010-11-05 16:38:52 +01:00
|
|
|
s = new (std::nothrow) push_t (parent_, tid_);
|
2010-08-06 17:49:37 +02:00
|
|
|
break;
|
2010-12-04 23:14:38 +01:00
|
|
|
case ZMQ_XPUB:
|
|
|
|
s = new (std::nothrow) xpub_t (parent_, tid_);
|
|
|
|
break;
|
|
|
|
case ZMQ_XSUB:
|
|
|
|
s = new (std::nothrow) xsub_t (parent_, tid_);
|
|
|
|
break;
|
2010-08-06 17:49:37 +02:00
|
|
|
default:
|
|
|
|
errno = EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
zmq_assert (s);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2010-11-05 16:38:52 +01:00
|
|
|
zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_) :
|
|
|
|
own_t (parent_, tid_),
|
2010-09-21 09:00:46 +02:00
|
|
|
ctx_terminated (false),
|
2010-08-12 15:03:51 +02:00
|
|
|
destroyed (false),
|
2010-09-26 16:55:54 +02:00
|
|
|
last_tsc (0),
|
2009-08-27 10:54:28 +02:00
|
|
|
ticks (0),
|
2010-08-11 14:09:56 +02:00
|
|
|
rcvmore (false)
|
2009-08-27 10:54:28 +02:00
|
|
|
{
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
zmq::socket_base_t::~socket_base_t ()
|
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
zmq_assert (destroyed);
|
2010-08-12 08:16:18 +02:00
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
// Check whether there are no session leaks.
|
|
|
|
sessions_sync.lock ();
|
|
|
|
zmq_assert (sessions.empty ());
|
|
|
|
sessions_sync.unlock ();
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
2010-11-05 17:39:51 +01:00
|
|
|
zmq::mailbox_t *zmq::socket_base_t::get_mailbox ()
|
2010-08-06 17:49:37 +02:00
|
|
|
{
|
2010-11-05 17:39:51 +01:00
|
|
|
return &mailbox;
|
2010-08-06 17:49:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void zmq::socket_base_t::stop ()
|
|
|
|
{
|
|
|
|
// Called by ctx when it is terminated (zmq_term).
|
|
|
|
// 'stop' command is sent from the threads that called zmq_term to
|
|
|
|
// the thread owning the socket. This way, blocking call in the
|
|
|
|
// owner thread can be interrupted.
|
|
|
|
send_stop ();
|
|
|
|
}
|
|
|
|
|
2010-12-13 15:40:26 +01:00
|
|
|
int zmq::socket_base_t::parse_uri (const char *uri_,
|
|
|
|
std::string &protocol_, std::string &address_)
|
|
|
|
{
|
|
|
|
zmq_assert (uri_ != NULL);
|
|
|
|
|
|
|
|
std::string uri (uri_);
|
|
|
|
std::string::size_type pos = uri.find ("://");
|
|
|
|
if (pos == std::string::npos) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
protocol_ = uri.substr (0, pos);
|
|
|
|
address_ = uri.substr (pos + 3);
|
|
|
|
if (protocol_.empty () || address_.empty ()) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
int zmq::socket_base_t::check_protocol (const std::string &protocol_)
|
|
|
|
{
|
|
|
|
// First check out whether the protcol is something we are aware of.
|
|
|
|
if (protocol_ != "inproc" && protocol_ != "ipc" && protocol_ != "tcp" &&
|
2010-09-01 15:24:46 +02:00
|
|
|
protocol_ != "pgm" && protocol_ != "epgm" && protocol_ != "sys") {
|
2010-08-11 14:09:56 +02:00
|
|
|
errno = EPROTONOSUPPORT;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If 0MQ is not compiled with OpenPGM, pgm and epgm transports
|
|
|
|
// are not avaialble.
|
|
|
|
#if !defined ZMQ_HAVE_OPENPGM
|
|
|
|
if (protocol_ == "pgm" || protocol_ == "epgm") {
|
|
|
|
errno = EPROTONOSUPPORT;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// IPC transport is not available on Windows and OpenVMS.
|
|
|
|
#if defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS
|
2010-08-30 12:10:40 +02:00
|
|
|
if (protocol_ == "ipc") {
|
2010-08-11 14:09:56 +02:00
|
|
|
// Unknown protocol.
|
|
|
|
errno = EPROTONOSUPPORT;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Check whether socket type and transport protocol match.
|
|
|
|
// Specifically, multicast protocols can't be combined with
|
|
|
|
// bi-directional messaging patterns (socket types).
|
|
|
|
if ((protocol_ == "pgm" || protocol_ == "epgm") &&
|
2011-01-28 07:50:21 +01:00
|
|
|
options.type != ZMQ_PUB && options.type != ZMQ_SUB &&
|
|
|
|
options.type != ZMQ_XPUB && options.type != ZMQ_XSUB) {
|
2010-08-11 14:09:56 +02:00
|
|
|
errno = ENOCOMPATPROTO;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Protocol is available.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
void zmq::socket_base_t::attach_pipes (class reader_t *inpipe_,
|
|
|
|
class writer_t *outpipe_, const blob_t &peer_identity_)
|
|
|
|
{
|
|
|
|
// If the peer haven't specified it's identity, let's generate one.
|
|
|
|
if (peer_identity_.size ()) {
|
|
|
|
xattach_pipes (inpipe_, outpipe_, peer_identity_);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
blob_t identity (1, 0);
|
|
|
|
identity.append (uuid_t ().to_blob (), uuid_t::uuid_blob_len);
|
|
|
|
xattach_pipes (inpipe_, outpipe_, identity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-21 14:29:22 +02:00
|
|
|
int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
|
2009-08-09 09:24:48 +02:00
|
|
|
size_t optvallen_)
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-04-11 16:36:27 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-09-21 14:39:59 +02:00
|
|
|
// First, check whether specific socket type overloads the option.
|
|
|
|
int rc = xsetsockopt (option_, optval_, optvallen_);
|
|
|
|
if (rc == 0 || errno != EINVAL)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
// If the socket type doesn't support the option, pass it to
|
|
|
|
// the generic option parser.
|
|
|
|
return options.setsockopt (option_, optval_, optvallen_);
|
2009-08-09 09:24:48 +02:00
|
|
|
}
|
|
|
|
|
2010-04-09 13:04:15 +02:00
|
|
|
int zmq::socket_base_t::getsockopt (int option_, void *optval_,
|
|
|
|
size_t *optvallen_)
|
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-04-11 16:36:27 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-11 10:26:47 +02:00
|
|
|
if (option_ == ZMQ_RCVMORE) {
|
|
|
|
if (*optvallen_ < sizeof (int64_t)) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*((int64_t*) optval_) = rcvmore ? 1 : 0;
|
|
|
|
*optvallen_ = sizeof (int64_t);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
if (option_ == ZMQ_FD) {
|
|
|
|
if (*optvallen_ < sizeof (fd_t)) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
2010-11-05 17:39:51 +01:00
|
|
|
*((fd_t*) optval_) = mailbox.get_fd ();
|
2010-08-06 17:49:37 +02:00
|
|
|
*optvallen_ = sizeof (fd_t);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (option_ == ZMQ_EVENTS) {
|
|
|
|
if (*optvallen_ < sizeof (uint32_t)) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
2010-09-08 08:39:27 +02:00
|
|
|
int rc = process_commands (false, false);
|
2011-01-05 16:57:51 +01:00
|
|
|
if (rc != 0 && (errno == EINTR || errno == ETERM))
|
2010-09-08 08:39:27 +02:00
|
|
|
return -1;
|
|
|
|
errno_assert (rc == 0);
|
2010-08-06 17:49:37 +02:00
|
|
|
*((uint32_t*) optval_) = 0;
|
|
|
|
if (has_out ())
|
|
|
|
*((uint32_t*) optval_) |= ZMQ_POLLOUT;
|
|
|
|
if (has_in ())
|
|
|
|
*((uint32_t*) optval_) |= ZMQ_POLLIN;
|
|
|
|
*optvallen_ = sizeof (uint32_t);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-09 13:04:15 +02:00
|
|
|
return options.getsockopt (option_, optval_, optvallen_);
|
|
|
|
}
|
|
|
|
|
2009-08-09 09:24:48 +02:00
|
|
|
int zmq::socket_base_t::bind (const char *addr_)
|
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-04-11 16:36:27 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-09-16 10:11:01 +02:00
|
|
|
// Parse addr_ string.
|
2010-08-11 14:09:56 +02:00
|
|
|
std::string protocol;
|
|
|
|
std::string address;
|
2010-12-13 15:40:26 +01:00
|
|
|
int rc = parse_uri (addr_, protocol, address);
|
|
|
|
if (rc != 0)
|
|
|
|
return -1;
|
2009-08-09 11:21:47 +02:00
|
|
|
|
2010-12-13 15:40:26 +01:00
|
|
|
rc = check_protocol (protocol);
|
2010-08-11 14:09:56 +02:00
|
|
|
if (rc != 0)
|
|
|
|
return -1;
|
2010-01-15 14:11:39 +01:00
|
|
|
|
2011-01-10 13:53:30 +01:00
|
|
|
if (protocol == "inproc" || protocol == "sys") {
|
|
|
|
endpoint_t endpoint = {this, options};
|
|
|
|
return register_endpoint (addr_, endpoint);
|
|
|
|
}
|
2010-01-15 14:11:39 +01:00
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
if (protocol == "tcp" || protocol == "ipc") {
|
2010-09-09 08:25:00 +02:00
|
|
|
|
|
|
|
// Choose I/O thread to run the listerner in.
|
|
|
|
io_thread_t *io_thread = choose_io_thread (options.affinity);
|
|
|
|
if (!io_thread) {
|
|
|
|
errno = EMTHREAD;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create and run the listener.
|
2009-12-15 23:49:55 +01:00
|
|
|
zmq_listener_t *listener = new (std::nothrow) zmq_listener_t (
|
2010-09-09 08:25:00 +02:00
|
|
|
io_thread, this, options);
|
2009-12-15 23:49:55 +01:00
|
|
|
zmq_assert (listener);
|
2010-08-11 14:09:56 +02:00
|
|
|
int rc = listener->set_address (protocol.c_str(), address.c_str ());
|
2010-02-12 15:08:57 +01:00
|
|
|
if (rc != 0) {
|
|
|
|
delete listener;
|
2009-09-16 10:11:01 +02:00
|
|
|
return -1;
|
2010-02-12 15:08:57 +01:00
|
|
|
}
|
2010-08-11 14:09:56 +02:00
|
|
|
launch_child (listener);
|
2009-09-16 10:11:01 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
if (protocol == "pgm" || protocol == "epgm") {
|
|
|
|
|
|
|
|
// For convenience's sake, bind can be used interchageable with
|
|
|
|
// connect for PGM and EPGM transports.
|
2009-09-16 10:11:01 +02:00
|
|
|
return connect (addr_);
|
|
|
|
}
|
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
zmq_assert (false);
|
2010-08-24 15:58:48 +02:00
|
|
|
return -1;
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
2009-08-09 09:24:48 +02:00
|
|
|
int zmq::socket_base_t::connect (const char *addr_)
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-04-11 16:36:27 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-09-11 17:58:37 +02:00
|
|
|
// Parse addr_ string.
|
2010-08-11 14:09:56 +02:00
|
|
|
std::string protocol;
|
|
|
|
std::string address;
|
2010-12-13 15:40:26 +01:00
|
|
|
int rc = parse_uri (addr_, protocol, address);
|
|
|
|
if (rc != 0)
|
|
|
|
return -1;
|
2009-09-11 17:58:37 +02:00
|
|
|
|
2010-12-13 15:40:26 +01:00
|
|
|
rc = check_protocol (protocol);
|
2010-08-11 14:09:56 +02:00
|
|
|
if (rc != 0)
|
|
|
|
return -1;
|
2009-09-11 17:58:37 +02:00
|
|
|
|
2010-09-01 15:24:46 +02:00
|
|
|
if (protocol == "inproc" || protocol == "sys") {
|
2009-11-21 20:59:55 +01:00
|
|
|
|
2010-02-14 13:34:48 +01:00
|
|
|
// TODO: inproc connect is specific with respect to creating pipes
|
|
|
|
// as there's no 'reconnect' functionality implemented. Once that
|
|
|
|
// is in place we should follow generic pipe creation algorithm.
|
|
|
|
|
2011-01-10 13:53:30 +01:00
|
|
|
// Find the peer endpoint.
|
|
|
|
endpoint_t peer = find_endpoint (addr_);
|
|
|
|
if (!peer.socket)
|
2009-11-21 20:59:55 +01:00
|
|
|
return -1;
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
reader_t *inpipe_reader = NULL;
|
|
|
|
writer_t *inpipe_writer = NULL;
|
|
|
|
reader_t *outpipe_reader = NULL;
|
|
|
|
writer_t *outpipe_writer = NULL;
|
2011-01-10 13:53:30 +01:00
|
|
|
|
|
|
|
// The total HWM for an inproc connection should be the sum of
|
|
|
|
// the binder's HWM and the connector's HWM. (Similarly for the
|
|
|
|
// SWAP.)
|
|
|
|
int64_t hwm;
|
|
|
|
if (options.hwm == 0 || peer.options.hwm == 0)
|
|
|
|
hwm = 0;
|
|
|
|
else
|
|
|
|
hwm = options.hwm + peer.options.hwm;
|
|
|
|
int64_t swap;
|
|
|
|
if (options.swap == 0 && peer.options.swap == 0)
|
|
|
|
swap = 0;
|
|
|
|
else
|
|
|
|
swap = options.swap + peer.options.swap;
|
|
|
|
|
2009-11-21 20:59:55 +01:00
|
|
|
// Create inbound pipe, if required.
|
2010-08-06 17:49:37 +02:00
|
|
|
if (options.requires_in)
|
2011-01-10 13:53:30 +01:00
|
|
|
create_pipe (this, peer.socket, hwm, swap,
|
2010-08-06 17:49:37 +02:00
|
|
|
&inpipe_reader, &inpipe_writer);
|
2009-11-21 20:59:55 +01:00
|
|
|
|
|
|
|
// Create outbound pipe, if required.
|
2010-08-06 17:49:37 +02:00
|
|
|
if (options.requires_out)
|
2011-01-10 13:53:30 +01:00
|
|
|
create_pipe (peer.socket, this, hwm, swap,
|
2010-08-06 17:49:37 +02:00
|
|
|
&outpipe_reader, &outpipe_writer);
|
2009-11-21 20:59:55 +01:00
|
|
|
|
|
|
|
// Attach the pipes to this socket object.
|
2010-08-06 17:49:37 +02:00
|
|
|
attach_pipes (inpipe_reader, outpipe_writer, blob_t ());
|
2009-11-21 20:59:55 +01:00
|
|
|
|
|
|
|
// Attach the pipes to the peer socket. Note that peer's seqnum
|
2010-08-11 14:09:56 +02:00
|
|
|
// was incremented in find_endpoint function. We don't need it
|
|
|
|
// increased here.
|
2011-01-10 13:53:30 +01:00
|
|
|
send_bind (peer.socket, outpipe_reader, inpipe_writer,
|
2010-08-06 17:49:37 +02:00
|
|
|
options.identity, false);
|
2009-11-21 20:59:55 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-09 08:25:00 +02:00
|
|
|
// Choose the I/O thread to run the session in.
|
|
|
|
io_thread_t *io_thread = choose_io_thread (options.affinity);
|
|
|
|
if (!io_thread) {
|
|
|
|
errno = EMTHREAD;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
// Create session.
|
|
|
|
connect_session_t *session = new (std::nothrow) connect_session_t (
|
2010-09-09 08:25:00 +02:00
|
|
|
io_thread, this, options, protocol.c_str (), address.c_str ());
|
2009-08-21 14:29:22 +02:00
|
|
|
zmq_assert (session);
|
2009-08-27 10:54:28 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
// If 'immediate connect' feature is required, we'll create the pipes
|
2010-02-14 13:34:48 +01:00
|
|
|
// to the session straight away. Otherwise, they'll be created by the
|
|
|
|
// session once the connection is established.
|
|
|
|
if (options.immediate_connect) {
|
2009-09-21 14:39:59 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
reader_t *inpipe_reader = NULL;
|
|
|
|
writer_t *inpipe_writer = NULL;
|
|
|
|
reader_t *outpipe_reader = NULL;
|
|
|
|
writer_t *outpipe_writer = NULL;
|
2009-09-21 14:39:59 +02:00
|
|
|
|
2010-02-14 13:34:48 +01:00
|
|
|
// Create inbound pipe, if required.
|
2010-08-06 17:49:37 +02:00
|
|
|
if (options.requires_in)
|
|
|
|
create_pipe (this, session, options.hwm, options.swap,
|
|
|
|
&inpipe_reader, &inpipe_writer);
|
2009-09-21 14:39:59 +02:00
|
|
|
|
2010-02-14 13:34:48 +01:00
|
|
|
// Create outbound pipe, if required.
|
2010-08-06 17:49:37 +02:00
|
|
|
if (options.requires_out)
|
|
|
|
create_pipe (session, this, options.hwm, options.swap,
|
|
|
|
&outpipe_reader, &outpipe_writer);
|
2009-09-21 14:39:59 +02:00
|
|
|
|
2010-02-14 13:34:48 +01:00
|
|
|
// Attach the pipes to the socket object.
|
2010-08-06 17:49:37 +02:00
|
|
|
attach_pipes (inpipe_reader, outpipe_writer, blob_t ());
|
2010-02-14 13:34:48 +01:00
|
|
|
|
|
|
|
// Attach the pipes to the session object.
|
2010-08-06 17:49:37 +02:00
|
|
|
session->attach_pipes (outpipe_reader, inpipe_writer, blob_t ());
|
2010-02-14 13:34:48 +01:00
|
|
|
}
|
2009-08-27 10:54:28 +02:00
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
// Activate the session. Make it a child of this socket.
|
|
|
|
launch_child (session);
|
2009-09-11 17:58:37 +02:00
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
return 0;
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
2009-08-21 14:29:22 +02:00
|
|
|
int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_)
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-08-06 17:49:37 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-11 16:36:27 +02:00
|
|
|
// Process pending commands, if any.
|
2010-09-08 08:39:27 +02:00
|
|
|
int rc = process_commands (false, true);
|
|
|
|
if (unlikely (rc != 0))
|
2010-04-11 16:36:27 +02:00
|
|
|
return -1;
|
|
|
|
|
2010-04-11 10:26:47 +02:00
|
|
|
// At this point we impose the MORE flag on the message.
|
|
|
|
if (flags_ & ZMQ_SNDMORE)
|
2010-03-27 21:25:40 +01:00
|
|
|
msg_->flags |= ZMQ_MSG_MORE;
|
2010-03-27 14:57:56 +01:00
|
|
|
|
2009-08-27 10:54:28 +02:00
|
|
|
// Try to send the message.
|
2010-09-08 08:39:27 +02:00
|
|
|
rc = xsend (msg_, flags_);
|
2009-09-21 14:39:59 +02:00
|
|
|
if (rc == 0)
|
|
|
|
return 0;
|
2009-08-27 10:54:28 +02:00
|
|
|
|
2009-09-21 14:39:59 +02:00
|
|
|
// In case of non-blocking send we'll simply propagate
|
|
|
|
// the error - including EAGAIN - upwards.
|
|
|
|
if (flags_ & ZMQ_NOBLOCK)
|
2009-08-27 10:54:28 +02:00
|
|
|
return -1;
|
|
|
|
|
2009-09-21 14:39:59 +02:00
|
|
|
// Oops, we couldn't send the message. Wait for the next
|
|
|
|
// command, process it and try to send the message again.
|
|
|
|
while (rc != 0) {
|
|
|
|
if (errno != EAGAIN)
|
|
|
|
return -1;
|
2010-09-08 08:39:27 +02:00
|
|
|
if (unlikely (process_commands (true, false) != 0))
|
2010-04-11 16:36:27 +02:00
|
|
|
return -1;
|
2009-09-21 14:39:59 +02:00
|
|
|
rc = xsend (msg_, flags_);
|
|
|
|
}
|
2009-08-27 10:54:28 +02:00
|
|
|
return 0;
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
2009-08-21 14:29:22 +02:00
|
|
|
int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
2010-09-21 09:00:46 +02:00
|
|
|
if (unlikely (ctx_terminated)) {
|
2010-08-06 17:49:37 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-02-12 12:12:49 +01:00
|
|
|
// Get the message.
|
2009-09-21 14:39:59 +02:00
|
|
|
int rc = xrecv (msg_, flags_);
|
2010-02-17 20:33:00 +01:00
|
|
|
int err = errno;
|
2010-02-12 12:12:49 +01:00
|
|
|
|
|
|
|
// Once every inbound_poll_rate messages check for signals and process
|
|
|
|
// incoming commands. This happens only if we are not polling altogether
|
|
|
|
// because there are messages available all the time. If poll occurs,
|
|
|
|
// ticks is set to zero and thus we avoid this code.
|
|
|
|
//
|
|
|
|
// Note that 'recv' uses different command throttling algorithm (the one
|
|
|
|
// described above) from the one used by 'send'. This is because counting
|
2010-09-26 16:55:54 +02:00
|
|
|
// ticks is more efficient than doing RDTSC all the time.
|
2010-02-12 12:12:49 +01:00
|
|
|
if (++ticks == inbound_poll_rate) {
|
2010-09-08 08:39:27 +02:00
|
|
|
if (unlikely (process_commands (false, false) != 0))
|
2010-04-11 16:36:27 +02:00
|
|
|
return -1;
|
2010-02-12 12:12:49 +01:00
|
|
|
ticks = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we have the message, return immediately.
|
2010-04-11 10:26:47 +02:00
|
|
|
if (rc == 0) {
|
|
|
|
rcvmore = msg_->flags & ZMQ_MSG_MORE;
|
|
|
|
if (rcvmore)
|
|
|
|
msg_->flags &= ~ZMQ_MSG_MORE;
|
2009-09-21 14:39:59 +02:00
|
|
|
return 0;
|
2010-04-11 10:26:47 +02:00
|
|
|
}
|
2009-09-21 14:39:59 +02:00
|
|
|
|
2010-02-17 21:16:59 +01:00
|
|
|
// If we don't have the message, restore the original cause of the problem.
|
|
|
|
errno = err;
|
|
|
|
|
2009-08-27 10:54:28 +02:00
|
|
|
// If the message cannot be fetched immediately, there are two scenarios.
|
2010-08-28 10:15:03 +02:00
|
|
|
// For non-blocking recv, commands are processed in case there's an
|
|
|
|
// activate_reader command already waiting int a command pipe.
|
|
|
|
// If it's not, return EAGAIN.
|
2009-09-21 14:39:59 +02:00
|
|
|
if (flags_ & ZMQ_NOBLOCK) {
|
|
|
|
if (errno != EAGAIN)
|
|
|
|
return -1;
|
2010-09-08 08:39:27 +02:00
|
|
|
if (unlikely (process_commands (false, false) != 0))
|
2010-04-11 16:36:27 +02:00
|
|
|
return -1;
|
2009-12-28 21:29:31 +01:00
|
|
|
ticks = 0;
|
2010-06-11 08:03:34 +02:00
|
|
|
|
|
|
|
rc = xrecv (msg_, flags_);
|
|
|
|
if (rc == 0) {
|
|
|
|
rcvmore = msg_->flags & ZMQ_MSG_MORE;
|
|
|
|
if (rcvmore)
|
|
|
|
msg_->flags &= ~ZMQ_MSG_MORE;
|
|
|
|
}
|
|
|
|
return rc;
|
2009-08-27 10:54:28 +02:00
|
|
|
}
|
|
|
|
|
2010-02-17 21:16:59 +01:00
|
|
|
// In blocking scenario, commands are processed over and over again until
|
|
|
|
// we are able to fetch a message.
|
2010-11-12 14:38:25 +01:00
|
|
|
bool block = (ticks != 0);
|
2010-02-17 21:16:59 +01:00
|
|
|
while (rc != 0) {
|
|
|
|
if (errno != EAGAIN)
|
|
|
|
return -1;
|
2010-11-12 14:47:26 +01:00
|
|
|
if (unlikely (process_commands (block, false) != 0))
|
2010-04-11 16:36:27 +02:00
|
|
|
return -1;
|
2010-02-17 21:16:59 +01:00
|
|
|
rc = xrecv (msg_, flags_);
|
|
|
|
ticks = 0;
|
2010-11-12 14:38:25 +01:00
|
|
|
block = true;
|
2010-02-17 21:16:59 +01:00
|
|
|
}
|
2010-04-11 10:26:47 +02:00
|
|
|
|
|
|
|
rcvmore = msg_->flags & ZMQ_MSG_MORE;
|
|
|
|
if (rcvmore)
|
|
|
|
msg_->flags &= ~ZMQ_MSG_MORE;
|
2010-02-17 21:16:59 +01:00
|
|
|
return 0;
|
2009-08-08 16:01:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int zmq::socket_base_t::close ()
|
|
|
|
{
|
2011-02-09 15:32:15 +01:00
|
|
|
// Transfer the ownership of the socket from this application thread
|
|
|
|
// to the reaper thread which will take care of the rest of shutdown
|
|
|
|
// process.
|
|
|
|
send_reap (this);
|
2009-09-04 16:02:41 +02:00
|
|
|
|
2009-08-08 16:01:58 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-10-01 10:56:17 +02:00
|
|
|
bool zmq::socket_base_t::has_in ()
|
|
|
|
{
|
|
|
|
return xhas_in ();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool zmq::socket_base_t::has_out ()
|
|
|
|
{
|
|
|
|
return xhas_out ();
|
|
|
|
}
|
|
|
|
|
2010-08-24 11:19:22 +02:00
|
|
|
bool zmq::socket_base_t::register_session (const blob_t &name_,
|
2010-02-13 14:07:30 +01:00
|
|
|
session_t *session_)
|
2009-08-20 11:32:23 +02:00
|
|
|
{
|
|
|
|
sessions_sync.lock ();
|
2010-08-11 14:09:56 +02:00
|
|
|
bool registered = sessions.insert (
|
2010-10-14 12:13:52 +02:00
|
|
|
sessions_t::value_type (name_, session_)).second;
|
2009-08-20 11:32:23 +02:00
|
|
|
sessions_sync.unlock ();
|
2009-08-21 14:29:22 +02:00
|
|
|
return registered;
|
2009-08-20 11:32:23 +02:00
|
|
|
}
|
|
|
|
|
2010-08-24 11:19:22 +02:00
|
|
|
void zmq::socket_base_t::unregister_session (const blob_t &name_)
|
2009-08-20 11:32:23 +02:00
|
|
|
{
|
|
|
|
sessions_sync.lock ();
|
2010-08-24 11:19:22 +02:00
|
|
|
sessions_t::iterator it = sessions.find (name_);
|
2010-08-11 14:09:56 +02:00
|
|
|
zmq_assert (it != sessions.end ());
|
|
|
|
sessions.erase (it);
|
2009-08-20 11:32:23 +02:00
|
|
|
sessions_sync.unlock ();
|
|
|
|
}
|
|
|
|
|
2010-08-24 11:19:22 +02:00
|
|
|
zmq::session_t *zmq::socket_base_t::find_session (const blob_t &name_)
|
2009-08-20 11:32:23 +02:00
|
|
|
{
|
|
|
|
sessions_sync.lock ();
|
2010-08-24 11:19:22 +02:00
|
|
|
sessions_t::iterator it = sessions.find (name_);
|
2010-08-11 14:09:56 +02:00
|
|
|
if (it == sessions.end ()) {
|
2009-12-23 19:37:56 +01:00
|
|
|
sessions_sync.unlock ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
session_t *session = it->second;
|
|
|
|
|
|
|
|
// Prepare the session for subsequent attach command.
|
|
|
|
session->inc_seqnum ();
|
|
|
|
|
|
|
|
sessions_sync.unlock ();
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
2011-02-09 22:23:21 +01:00
|
|
|
void zmq::socket_base_t::start_reaping (poller_t *poller_)
|
2009-09-02 10:22:23 +02:00
|
|
|
{
|
2011-02-09 22:23:21 +01:00
|
|
|
poller = poller_;
|
|
|
|
handle = poller->add_fd (mailbox.get_fd (), this);
|
|
|
|
poller->set_pollin (handle);
|
2010-03-01 10:13:26 +01:00
|
|
|
}
|
|
|
|
|
2010-09-08 08:39:27 +02:00
|
|
|
int zmq::socket_base_t::process_commands (bool block_, bool throttle_)
|
2009-08-27 10:54:28 +02:00
|
|
|
{
|
2010-09-08 08:39:27 +02:00
|
|
|
int rc;
|
2010-08-06 17:49:37 +02:00
|
|
|
command_t cmd;
|
|
|
|
if (block_) {
|
2010-11-05 17:39:51 +01:00
|
|
|
rc = mailbox.recv (&cmd, true);
|
2010-09-08 08:39:27 +02:00
|
|
|
if (rc == -1 && errno == EINTR)
|
|
|
|
return -1;
|
|
|
|
errno_assert (rc == 0);
|
2010-06-17 11:01:18 +02:00
|
|
|
}
|
|
|
|
else {
|
2010-08-06 17:49:37 +02:00
|
|
|
|
2010-09-26 16:55:54 +02:00
|
|
|
// Get the CPU's tick counter. If 0, the counter is not available.
|
|
|
|
uint64_t tsc = zmq::clock_t::rdtsc ();
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
// Optimised version of command processing - it doesn't have to check
|
|
|
|
// for incoming commands each time. It does so only if certain time
|
|
|
|
// elapsed since last command processing. Command delay varies
|
|
|
|
// depending on CPU speed: It's ~1ms on 3GHz CPU, ~2ms on 1.5GHz CPU
|
|
|
|
// etc. The optimisation makes sense only on platforms where getting
|
|
|
|
// a timestamp is a very cheap operation (tens of nanoseconds).
|
2010-09-26 16:55:54 +02:00
|
|
|
if (tsc && throttle_) {
|
|
|
|
|
2010-09-26 13:36:05 +02:00
|
|
|
// Check whether TSC haven't jumped backwards (in case of migration
|
|
|
|
// between CPU cores) and whether certain time have elapsed since
|
|
|
|
// last command processing. If it didn't do nothing.
|
2010-09-26 16:55:54 +02:00
|
|
|
if (tsc >= last_tsc && tsc - last_tsc <= max_command_delay)
|
2010-09-08 08:39:27 +02:00
|
|
|
return 0;
|
2010-09-26 16:55:54 +02:00
|
|
|
last_tsc = tsc;
|
2010-08-06 17:49:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check whether there are any commands pending for this thread.
|
2010-11-05 17:39:51 +01:00
|
|
|
rc = mailbox.recv (&cmd, false);
|
2010-06-17 11:01:18 +02:00
|
|
|
}
|
2009-08-27 10:54:28 +02:00
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
// Process all the commands available at the moment.
|
2010-09-08 08:39:27 +02:00
|
|
|
while (true) {
|
|
|
|
if (rc == -1 && errno == EAGAIN)
|
|
|
|
break;
|
|
|
|
if (rc == -1 && errno == EINTR)
|
|
|
|
return -1;
|
|
|
|
errno_assert (rc == 0);
|
2010-08-06 17:49:37 +02:00
|
|
|
cmd.destination->process_command (cmd);
|
2010-11-05 17:39:51 +01:00
|
|
|
rc = mailbox.recv (&cmd, false);
|
2010-09-08 08:39:27 +02:00
|
|
|
}
|
|
|
|
|
2010-09-21 09:00:46 +02:00
|
|
|
if (ctx_terminated) {
|
2010-09-08 08:39:27 +02:00
|
|
|
errno = ETERM;
|
|
|
|
return -1;
|
2010-08-06 17:49:37 +02:00
|
|
|
}
|
2010-09-08 08:39:27 +02:00
|
|
|
|
|
|
|
return 0;
|
2009-08-28 16:51:46 +02:00
|
|
|
}
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
void zmq::socket_base_t::process_stop ()
|
2009-08-28 16:51:46 +02:00
|
|
|
{
|
2010-08-06 17:49:37 +02:00
|
|
|
// Here, someone have called zmq_term while the socket was still alive.
|
2010-09-21 09:00:46 +02:00
|
|
|
// We'll remember the fact so that any blocking call is interrupted and any
|
2010-08-06 17:49:37 +02:00
|
|
|
// further attempt to use the socket will return ETERM. The user is still
|
|
|
|
// responsible for calling zmq_close on the socket though!
|
2010-09-21 09:00:46 +02:00
|
|
|
ctx_terminated = true;
|
2009-09-02 16:16:25 +02:00
|
|
|
}
|
|
|
|
|
2010-02-13 15:30:03 +01:00
|
|
|
void zmq::socket_base_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_,
|
|
|
|
const blob_t &peer_identity_)
|
2009-08-27 10:54:28 +02:00
|
|
|
{
|
2010-02-16 18:30:38 +01:00
|
|
|
attach_pipes (in_pipe_, out_pipe_, peer_identity_);
|
2009-08-27 10:54:28 +02:00
|
|
|
}
|
|
|
|
|
2010-08-11 14:09:56 +02:00
|
|
|
void zmq::socket_base_t::process_unplug ()
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-16 10:53:29 +02:00
|
|
|
void zmq::socket_base_t::process_term (int linger_)
|
2009-08-08 16:01:58 +02:00
|
|
|
{
|
2010-08-11 14:09:56 +02:00
|
|
|
// Unregister all inproc endpoints associated with this socket.
|
|
|
|
// Doing this we make sure that no new pipes from other sockets (inproc)
|
|
|
|
// will be initiated.
|
|
|
|
unregister_endpoints (this);
|
|
|
|
|
|
|
|
// Continue the termination process immediately.
|
2010-10-16 10:53:29 +02:00
|
|
|
own_t::process_term (linger_);
|
2009-12-02 21:26:47 +01:00
|
|
|
}
|
|
|
|
|
2010-08-12 15:03:51 +02:00
|
|
|
void zmq::socket_base_t::process_destroy ()
|
|
|
|
{
|
|
|
|
destroyed = true;
|
|
|
|
}
|
|
|
|
|
2010-08-06 17:49:37 +02:00
|
|
|
int zmq::socket_base_t::xsetsockopt (int option_, const void *optval_,
|
|
|
|
size_t optvallen_)
|
|
|
|
{
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool zmq::socket_base_t::xhas_out ()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int zmq::socket_base_t::xsend (zmq_msg_t *msg_, int options_)
|
|
|
|
{
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool zmq::socket_base_t::xhas_in ()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int zmq::socket_base_t::xrecv (zmq_msg_t *msg_, int options_)
|
|
|
|
{
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-02-09 22:23:21 +01:00
|
|
|
void zmq::socket_base_t::in_event ()
|
|
|
|
{
|
|
|
|
// Process any commands from other threads/sockets that may be available
|
|
|
|
// at the moment. Ultimately, socket will be destroyed.
|
|
|
|
process_commands (false, false);
|
|
|
|
|
|
|
|
// If the object was already marked as destroyed, finish the deallocation.
|
|
|
|
if (destroyed) {
|
|
|
|
|
|
|
|
// Remove the socket from the reaper's poller.
|
|
|
|
poller->rm_fd (handle);
|
|
|
|
|
|
|
|
// Remove the socket from the context.
|
|
|
|
destroy_socket (this);
|
|
|
|
|
|
|
|
// Notify the reaper about the fact.
|
|
|
|
send_reaped ();
|
|
|
|
|
|
|
|
// Deallocate.
|
|
|
|
own_t::process_destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void zmq::socket_base_t::out_event ()
|
|
|
|
{
|
|
|
|
zmq_assert (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void zmq::socket_base_t::timer_event (int id_)
|
|
|
|
{
|
|
|
|
zmq_assert (false);
|
|
|
|
}
|