Problem: zmq_socket_get_peer_state is not implemented

Solution: add initial implementation
This commit is contained in:
sigiesec
2017-08-29 11:51:01 +02:00
parent cda20260b3
commit 48a1e637b6
5 changed files with 41 additions and 4 deletions

View File

@@ -443,6 +443,27 @@ zmq::blob_t zmq::router_t::get_credential () const
return fq.get_credential ();
}
int zmq::router_t::get_peer_state (const void *identity,
size_t identity_size) const
{
int res = 0;
blob_t identity_blob ((unsigned char *) identity, identity_size);
outpipes_t::const_iterator it = outpipes.find (identity_blob);
if (it == outpipes.end ()) {
errno = EHOSTUNREACH;
return -1;
}
const outpipe_t &outpipe = it->second;
if (outpipe.pipe->check_hwm ())
res |= ZMQ_POLLOUT;
/** \todo does it make any sense to check the inpipe as well? */
return res;
}
bool zmq::router_t::identify_peer (pipe_t *pipe_)
{
msg_t msg;