mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Merge pull request #1926 from hitstergtd/codespell-fixes
Problem: typos and trailing whitespace in code/comments
This commit is contained in:
commit
af82d0641c
@ -440,7 +440,7 @@ typedef struct zmq_pollitem_t
|
|||||||
ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
|
ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Poller polling on sockets,fd and threaf safe sockets */
|
/* Poller polling on sockets,fd and thread-safe sockets */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#define ZMQ_HAVE_POLLER
|
#define ZMQ_HAVE_POLLER
|
||||||
|
@ -55,7 +55,7 @@ namespace zmq
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overrides of functions from socket_base_t.
|
// Overrides of functions from socket_base_t.
|
||||||
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
|
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
|
||||||
int xsend (zmq::msg_t *msg_);
|
int xsend (zmq::msg_t *msg_);
|
||||||
int xrecv (zmq::msg_t *msg_);
|
int xrecv (zmq::msg_t *msg_);
|
||||||
bool xhas_in ();
|
bool xhas_in ();
|
||||||
@ -64,14 +64,14 @@ namespace zmq
|
|||||||
void xread_activated (zmq::pipe_t *pipe_);
|
void xread_activated (zmq::pipe_t *pipe_);
|
||||||
void xwrite_activated (zmq::pipe_t *pipe_);
|
void xwrite_activated (zmq::pipe_t *pipe_);
|
||||||
void xpipe_terminated (zmq::pipe_t *pipe_);
|
void xpipe_terminated (zmq::pipe_t *pipe_);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Messages are fair-queued from inbound pipes. And load-balanced to
|
// Messages are fair-queued from inbound pipes. And load-balanced to
|
||||||
// the outbound pipes.
|
// the outbound pipes.
|
||||||
fq_t fq;
|
fq_t fq;
|
||||||
lb_t lb;
|
lb_t lb;
|
||||||
|
|
||||||
client_t (const client_t &);
|
client_t (const client_t &);
|
||||||
const client_t &operator = (const client_t&);
|
const client_t &operator = (const client_t&);
|
||||||
};
|
};
|
||||||
|
@ -80,8 +80,8 @@ namespace zmq
|
|||||||
|
|
||||||
// On some OSes the signaler has to be emulated using a TCP
|
// On some OSes the signaler has to be emulated using a TCP
|
||||||
// connection. In such cases following port is used.
|
// connection. In such cases following port is used.
|
||||||
// If 0, it lets the OS choose a free port without requiring use of a
|
// If 0, it lets the OS choose a free port without requiring use of a
|
||||||
// global mutex. The original implementation of a Windows signaler
|
// global mutex. The original implementation of a Windows signaler
|
||||||
// socket used port 5905 instead of letting the OS choose a free port.
|
// socket used port 5905 instead of letting the OS choose a free port.
|
||||||
// https://github.com/zeromq/libzmq/issues/1542
|
// https://github.com/zeromq/libzmq/issues/1542
|
||||||
signaler_port = 0
|
signaler_port = 0
|
||||||
|
@ -77,7 +77,7 @@ void zmq::dist_t::match (pipe_t *pipe_)
|
|||||||
|
|
||||||
// Mark the pipe as matching.
|
// Mark the pipe as matching.
|
||||||
pipes.swap (pipes.index (pipe_), matching);
|
pipes.swap (pipes.index (pipe_), matching);
|
||||||
matching++;
|
matching++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::dist_t::reverse_match ()
|
void zmq::dist_t::reverse_match ()
|
||||||
|
@ -74,7 +74,7 @@ namespace zmq
|
|||||||
{
|
{
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function returns a batch of binary data. The data
|
// The function returns a batch of binary data. The data
|
||||||
// are filled to a supplied buffer. If no buffer is supplied (data_
|
// are filled to a supplied buffer. If no buffer is supplied (data_
|
||||||
// points to NULL) decoder object will provide buffer of its own.
|
// points to NULL) decoder object will provide buffer of its own.
|
||||||
|
102
src/err.cpp
102
src/err.cpp
@ -104,108 +104,108 @@ const char *zmq::wsa_error_no (int no_)
|
|||||||
// automatically (wsaError->HRESULT->string?).
|
// automatically (wsaError->HRESULT->string?).
|
||||||
return
|
return
|
||||||
(no_ == WSABASEERR) ?
|
(no_ == WSABASEERR) ?
|
||||||
"No Error" :
|
"No Error" :
|
||||||
(no_ == WSAEINTR) ?
|
(no_ == WSAEINTR) ?
|
||||||
"Interrupted system call" :
|
"Interrupted system call" :
|
||||||
(no_ == WSAEBADF) ?
|
(no_ == WSAEBADF) ?
|
||||||
"Bad file number" :
|
"Bad file number" :
|
||||||
(no_ == WSAEACCES) ?
|
(no_ == WSAEACCES) ?
|
||||||
"Permission denied" :
|
"Permission denied" :
|
||||||
(no_ == WSAEFAULT) ?
|
(no_ == WSAEFAULT) ?
|
||||||
"Bad address" :
|
"Bad address" :
|
||||||
(no_ == WSAEINVAL) ?
|
(no_ == WSAEINVAL) ?
|
||||||
"Invalid argument" :
|
"Invalid argument" :
|
||||||
(no_ == WSAEMFILE) ?
|
(no_ == WSAEMFILE) ?
|
||||||
"Too many open files" :
|
"Too many open files" :
|
||||||
(no_ == WSAEWOULDBLOCK) ?
|
(no_ == WSAEWOULDBLOCK) ?
|
||||||
"Operation would block" :
|
"Operation would block" :
|
||||||
(no_ == WSAEINPROGRESS) ?
|
(no_ == WSAEINPROGRESS) ?
|
||||||
"Operation now in progress" :
|
"Operation now in progress" :
|
||||||
(no_ == WSAEALREADY) ?
|
(no_ == WSAEALREADY) ?
|
||||||
"Operation already in progress" :
|
"Operation already in progress" :
|
||||||
(no_ == WSAENOTSOCK) ?
|
(no_ == WSAENOTSOCK) ?
|
||||||
"Socket operation on non-socket" :
|
"Socket operation on non-socket" :
|
||||||
(no_ == WSAEDESTADDRREQ) ?
|
(no_ == WSAEDESTADDRREQ) ?
|
||||||
"Destination address required" :
|
"Destination address required" :
|
||||||
(no_ == WSAEMSGSIZE) ?
|
(no_ == WSAEMSGSIZE) ?
|
||||||
"Message too long" :
|
"Message too long" :
|
||||||
(no_ == WSAEPROTOTYPE) ?
|
(no_ == WSAEPROTOTYPE) ?
|
||||||
"Protocol wrong type for socket" :
|
"Protocol wrong type for socket" :
|
||||||
(no_ == WSAENOPROTOOPT) ?
|
(no_ == WSAENOPROTOOPT) ?
|
||||||
"Bad protocol option" :
|
"Bad protocol option" :
|
||||||
(no_ == WSAEPROTONOSUPPORT) ?
|
(no_ == WSAEPROTONOSUPPORT) ?
|
||||||
"Protocol not supported" :
|
"Protocol not supported" :
|
||||||
(no_ == WSAESOCKTNOSUPPORT) ?
|
(no_ == WSAESOCKTNOSUPPORT) ?
|
||||||
"Socket type not supported" :
|
"Socket type not supported" :
|
||||||
(no_ == WSAEOPNOTSUPP) ?
|
(no_ == WSAEOPNOTSUPP) ?
|
||||||
"Operation not supported on socket" :
|
"Operation not supported on socket" :
|
||||||
(no_ == WSAEPFNOSUPPORT) ?
|
(no_ == WSAEPFNOSUPPORT) ?
|
||||||
"Protocol family not supported" :
|
"Protocol family not supported" :
|
||||||
(no_ == WSAEAFNOSUPPORT) ?
|
(no_ == WSAEAFNOSUPPORT) ?
|
||||||
"Address family not supported by protocol family" :
|
"Address family not supported by protocol family" :
|
||||||
(no_ == WSAEADDRINUSE) ?
|
(no_ == WSAEADDRINUSE) ?
|
||||||
"Address already in use" :
|
"Address already in use" :
|
||||||
(no_ == WSAEADDRNOTAVAIL) ?
|
(no_ == WSAEADDRNOTAVAIL) ?
|
||||||
"Can't assign requested address" :
|
"Can't assign requested address" :
|
||||||
(no_ == WSAENETDOWN) ?
|
(no_ == WSAENETDOWN) ?
|
||||||
"Network is down" :
|
"Network is down" :
|
||||||
(no_ == WSAENETUNREACH) ?
|
(no_ == WSAENETUNREACH) ?
|
||||||
"Network is unreachable" :
|
"Network is unreachable" :
|
||||||
(no_ == WSAENETRESET) ?
|
(no_ == WSAENETRESET) ?
|
||||||
"Net dropped connection or reset" :
|
"Net dropped connection or reset" :
|
||||||
(no_ == WSAECONNABORTED) ?
|
(no_ == WSAECONNABORTED) ?
|
||||||
"Software caused connection abort" :
|
"Software caused connection abort" :
|
||||||
(no_ == WSAECONNRESET) ?
|
(no_ == WSAECONNRESET) ?
|
||||||
"Connection reset by peer" :
|
"Connection reset by peer" :
|
||||||
(no_ == WSAENOBUFS) ?
|
(no_ == WSAENOBUFS) ?
|
||||||
"No buffer space available" :
|
"No buffer space available" :
|
||||||
(no_ == WSAEISCONN) ?
|
(no_ == WSAEISCONN) ?
|
||||||
"Socket is already connected" :
|
"Socket is already connected" :
|
||||||
(no_ == WSAENOTCONN) ?
|
(no_ == WSAENOTCONN) ?
|
||||||
"Socket is not connected" :
|
"Socket is not connected" :
|
||||||
(no_ == WSAESHUTDOWN) ?
|
(no_ == WSAESHUTDOWN) ?
|
||||||
"Can't send after socket shutdown" :
|
"Can't send after socket shutdown" :
|
||||||
(no_ == WSAETOOMANYREFS) ?
|
(no_ == WSAETOOMANYREFS) ?
|
||||||
"Too many references can't splice" :
|
"Too many references can't splice" :
|
||||||
(no_ == WSAETIMEDOUT) ?
|
(no_ == WSAETIMEDOUT) ?
|
||||||
"Connection timed out" :
|
"Connection timed out" :
|
||||||
(no_ == WSAECONNREFUSED) ?
|
(no_ == WSAECONNREFUSED) ?
|
||||||
"Connection refused" :
|
"Connection refused" :
|
||||||
(no_ == WSAELOOP) ?
|
(no_ == WSAELOOP) ?
|
||||||
"Too many levels of symbolic links" :
|
"Too many levels of symbolic links" :
|
||||||
(no_ == WSAENAMETOOLONG) ?
|
(no_ == WSAENAMETOOLONG) ?
|
||||||
"File name too long" :
|
"File name too long" :
|
||||||
(no_ == WSAEHOSTDOWN) ?
|
(no_ == WSAEHOSTDOWN) ?
|
||||||
"Host is down" :
|
"Host is down" :
|
||||||
(no_ == WSAEHOSTUNREACH) ?
|
(no_ == WSAEHOSTUNREACH) ?
|
||||||
"No Route to Host" :
|
"No Route to Host" :
|
||||||
(no_ == WSAENOTEMPTY) ?
|
(no_ == WSAENOTEMPTY) ?
|
||||||
"Directory not empty" :
|
"Directory not empty" :
|
||||||
(no_ == WSAEPROCLIM) ?
|
(no_ == WSAEPROCLIM) ?
|
||||||
"Too many processes" :
|
"Too many processes" :
|
||||||
(no_ == WSAEUSERS) ?
|
(no_ == WSAEUSERS) ?
|
||||||
"Too many users" :
|
"Too many users" :
|
||||||
(no_ == WSAEDQUOT) ?
|
(no_ == WSAEDQUOT) ?
|
||||||
"Disc Quota Exceeded" :
|
"Disc Quota Exceeded" :
|
||||||
(no_ == WSAESTALE) ?
|
(no_ == WSAESTALE) ?
|
||||||
"Stale NFS file handle" :
|
"Stale NFS file handle" :
|
||||||
(no_ == WSAEREMOTE) ?
|
(no_ == WSAEREMOTE) ?
|
||||||
"Too many levels of remote in path" :
|
"Too many levels of remote in path" :
|
||||||
(no_ == WSASYSNOTREADY) ?
|
(no_ == WSASYSNOTREADY) ?
|
||||||
"Network SubSystem is unavailable" :
|
"Network SubSystem is unavailable" :
|
||||||
(no_ == WSAVERNOTSUPPORTED) ?
|
(no_ == WSAVERNOTSUPPORTED) ?
|
||||||
"WINSOCK DLL Version out of range" :
|
"WINSOCK DLL Version out of range" :
|
||||||
(no_ == WSANOTINITIALISED) ?
|
(no_ == WSANOTINITIALISED) ?
|
||||||
"Successful WSASTARTUP not yet performed" :
|
"Successful WSASTARTUP not yet performed" :
|
||||||
(no_ == WSAHOST_NOT_FOUND) ?
|
(no_ == WSAHOST_NOT_FOUND) ?
|
||||||
"Host not found" :
|
"Host not found" :
|
||||||
(no_ == WSATRY_AGAIN) ?
|
(no_ == WSATRY_AGAIN) ?
|
||||||
"Non-Authoritative Host not found" :
|
"Non-Authoritative Host not found" :
|
||||||
(no_ == WSANO_RECOVERY) ?
|
(no_ == WSANO_RECOVERY) ?
|
||||||
"Non-Recoverable errors: FORMERR REFUSED NOTIMP" :
|
"Non-Recoverable errors: FORMERR REFUSED NOTIMP" :
|
||||||
(no_ == WSANO_DATA) ?
|
(no_ == WSANO_DATA) ?
|
||||||
"Valid name no data record of requested" :
|
"Valid name no data record of requested" :
|
||||||
"error not defined";
|
"error not defined";
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::win_error (char *buffer_, size_t buffer_size_)
|
void zmq::win_error (char *buffer_, size_t buffer_size_)
|
||||||
|
@ -122,7 +122,7 @@ namespace zmq
|
|||||||
__FILE__, __LINE__);\
|
__FILE__, __LINE__);\
|
||||||
zmq::zmq_abort (#x);\
|
zmq::zmq_abort (#x);\
|
||||||
}\
|
}\
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
// Provides convenient way to check for errno-style errors.
|
// Provides convenient way to check for errno-style errors.
|
||||||
#define errno_assert(x) \
|
#define errno_assert(x) \
|
||||||
|
@ -26,30 +26,30 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
|
#ifndef __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
|
||||||
#define __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
|
#define __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
|
||||||
|
|
||||||
namespace zmq
|
namespace zmq
|
||||||
{
|
{
|
||||||
|
|
||||||
// Virtual interface to be exposed by object that want to be notified
|
// Virtual interface to be exposed by object that want to be notified
|
||||||
// about events on file descriptors.
|
// about events on file descriptors.
|
||||||
|
|
||||||
struct i_poll_events
|
struct i_poll_events
|
||||||
{
|
{
|
||||||
virtual ~i_poll_events () {}
|
virtual ~i_poll_events () {}
|
||||||
|
|
||||||
// Called by I/O thread when file descriptor is ready for reading.
|
// Called by I/O thread when file descriptor is ready for reading.
|
||||||
virtual void in_event () = 0;
|
virtual void in_event () = 0;
|
||||||
|
|
||||||
// Called by I/O thread when file descriptor is ready for writing.
|
// Called by I/O thread when file descriptor is ready for writing.
|
||||||
virtual void out_event () = 0;
|
virtual void out_event () = 0;
|
||||||
|
|
||||||
// Called when timer expires.
|
// Called when timer expires.
|
||||||
virtual void timer_event (int id_) = 0;
|
virtual void timer_event (int id_) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -188,14 +188,14 @@ int zmq::ipc_connecter_t::get_new_reconnect_ivl ()
|
|||||||
|
|
||||||
// Only change the current reconnect interval if the maximum reconnect
|
// Only change the current reconnect interval if the maximum reconnect
|
||||||
// interval was set and if it's larger than the reconnect interval.
|
// interval was set and if it's larger than the reconnect interval.
|
||||||
if (options.reconnect_ivl_max > 0 &&
|
if (options.reconnect_ivl_max > 0 &&
|
||||||
options.reconnect_ivl_max > options.reconnect_ivl) {
|
options.reconnect_ivl_max > options.reconnect_ivl) {
|
||||||
|
|
||||||
// Calculate the next interval
|
// Calculate the next interval
|
||||||
current_reconnect_ivl = current_reconnect_ivl * 2;
|
current_reconnect_ivl = current_reconnect_ivl * 2;
|
||||||
if(current_reconnect_ivl >= options.reconnect_ivl_max) {
|
if(current_reconnect_ivl >= options.reconnect_ivl_max) {
|
||||||
current_reconnect_ivl = options.reconnect_ivl_max;
|
current_reconnect_ivl = options.reconnect_ivl_max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this_interval;
|
return this_interval;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ int zmq::ipc_connecter_t::open ()
|
|||||||
// Connect was successful immediately.
|
// Connect was successful immediately.
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Translate other error codes indicating asynchronous connect has been
|
// Translate other error codes indicating asynchronous connect has been
|
||||||
// launched to a uniform EINPROGRESS.
|
// launched to a uniform EINPROGRESS.
|
||||||
if (rc == -1 && errno == EINTR) {
|
if (rc == -1 && errno == EINTR) {
|
||||||
|
@ -110,7 +110,7 @@ int zmq::lb_t::sendpipe (msg_t *msg_, pipe_t **pipe_)
|
|||||||
|
|
||||||
// If send fails for multi-part msg rollback other
|
// If send fails for multi-part msg rollback other
|
||||||
// parts sent earlier and return EAGAIN.
|
// parts sent earlier and return EAGAIN.
|
||||||
// Application should handle this as suitable
|
// Application should handle this as suitable
|
||||||
if (more)
|
if (more)
|
||||||
{
|
{
|
||||||
pipes [current]->rollback ();
|
pipes [current]->rollback ();
|
||||||
|
@ -64,7 +64,7 @@ void zmq::mailbox_safe_t::remove_signaler(signaler_t* signaler)
|
|||||||
// TODO: make a copy of array and signal outside the lock
|
// TODO: make a copy of array and signal outside the lock
|
||||||
for (; it != signalers.end(); ++it){
|
for (; it != signalers.end(); ++it){
|
||||||
if (*it == signaler)
|
if (*it == signaler)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it != signalers.end())
|
if (it != signalers.end())
|
||||||
@ -92,7 +92,7 @@ int zmq::mailbox_safe_t::recv (command_t *cmd_, int timeout_)
|
|||||||
// Try to get the command straight away.
|
// Try to get the command straight away.
|
||||||
if (cpipe.read (cmd_))
|
if (cpipe.read (cmd_))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Wait for signal from the command sender.
|
// Wait for signal from the command sender.
|
||||||
int rc = cond_var.wait (sync, timeout_);
|
int rc = cond_var.wait (sync, timeout_);
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
|
@ -64,8 +64,8 @@ namespace zmq
|
|||||||
// close the file descriptors in the signaller. This is used in a forked
|
// close the file descriptors in the signaller. This is used in a forked
|
||||||
// child process to close the file descriptors so that they do not interfere
|
// child process to close the file descriptors so that they do not interfere
|
||||||
// with the context in the parent process.
|
// with the context in the parent process.
|
||||||
void forked ()
|
void forked ()
|
||||||
{
|
{
|
||||||
// TODO: call fork on the condition variable
|
// TODO: call fork on the condition variable
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -121,7 +121,7 @@ void zmq::object_t::process_command (command_t &cmd_)
|
|||||||
case command_t::term_req:
|
case command_t::term_req:
|
||||||
process_term_req (cmd_.args.term_req.object);
|
process_term_req (cmd_.args.term_req.object);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case command_t::term:
|
case command_t::term:
|
||||||
process_term (cmd_.args.term.linger);
|
process_term (cmd_.args.term.linger);
|
||||||
break;
|
break;
|
||||||
@ -194,7 +194,7 @@ zmq::io_thread_t *zmq::object_t::choose_io_thread (uint64_t affinity_)
|
|||||||
void zmq::object_t::send_stop ()
|
void zmq::object_t::send_stop ()
|
||||||
{
|
{
|
||||||
// 'stop' command goes always from administrative thread to
|
// 'stop' command goes always from administrative thread to
|
||||||
// the current object.
|
// the current object.
|
||||||
command_t cmd;
|
command_t cmd;
|
||||||
cmd.destination = this;
|
cmd.destination = this;
|
||||||
cmd.type = command_t::stop;
|
cmd.type = command_t::stop;
|
||||||
|
@ -183,7 +183,7 @@ void zmq::own_t::unregister_term_ack ()
|
|||||||
term_acks--;
|
term_acks--;
|
||||||
|
|
||||||
// This may be a last ack we are waiting for before termination...
|
// This may be a last ack we are waiting for before termination...
|
||||||
check_term_acks ();
|
check_term_acks ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::own_t::process_term_ack ()
|
void zmq::own_t::process_term_ack ()
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "wire.hpp"
|
#include "wire.hpp"
|
||||||
#include "err.hpp"
|
#include "err.hpp"
|
||||||
|
|
||||||
zmq::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
|
zmq::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
|
||||||
const options_t &options_) :
|
const options_t &options_) :
|
||||||
io_object_t (parent_),
|
io_object_t (parent_),
|
||||||
has_rx_timer (false),
|
has_rx_timer (false),
|
||||||
|
@ -55,7 +55,7 @@ namespace zmq
|
|||||||
|
|
||||||
class pgm_receiver_t : public io_object_t, public i_engine
|
class pgm_receiver_t : public io_object_t, public i_engine
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
pgm_receiver_t (zmq::io_thread_t *parent_, const options_t &options_);
|
pgm_receiver_t (zmq::io_thread_t *parent_, const options_t &options_);
|
||||||
|
@ -111,7 +111,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Output buffer from pgm_socket.
|
// Output buffer from pgm_socket.
|
||||||
unsigned char *out_buffer;
|
unsigned char *out_buffer;
|
||||||
|
|
||||||
// Output buffer size.
|
// Output buffer size.
|
||||||
size_t out_buffer_size;
|
size_t out_buffer_size;
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ namespace zmq
|
|||||||
|
|
||||||
// Resolve PGM socket address.
|
// Resolve PGM socket address.
|
||||||
static int init_address(const char *network_, struct pgm_addrinfo_t **addr, uint16_t *port_number);
|
static int init_address(const char *network_, struct pgm_addrinfo_t **addr, uint16_t *port_number);
|
||||||
|
|
||||||
// Get receiver fds and store them into user allocated memory.
|
// Get receiver fds and store them into user allocated memory.
|
||||||
void get_receiver_fds (fd_t *receive_fd_, fd_t *waiting_pipe_fd_);
|
void get_receiver_fds (fd_t *receive_fd_, fd_t *waiting_pipe_fd_);
|
||||||
|
|
||||||
// Get sender and receiver fds and store it to user allocated
|
// Get sender and receiver fds and store it to user allocated
|
||||||
// memory. Receive fd is used to process NAKs from peers.
|
// memory. Receive fd is used to process NAKs from peers.
|
||||||
void get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
|
void get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
|
||||||
fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_);
|
fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_);
|
||||||
@ -88,7 +88,7 @@ namespace zmq
|
|||||||
long get_rx_timeout ();
|
long get_rx_timeout ();
|
||||||
long get_tx_timeout ();
|
long get_tx_timeout ();
|
||||||
|
|
||||||
// POLLIN on sender side should mean NAK or SPMR receiving.
|
// POLLIN on sender side should mean NAK or SPMR receiving.
|
||||||
// process_upstream function is used to handle such a situation.
|
// process_upstream function is used to handle such a situation.
|
||||||
void process_upstream ();
|
void process_upstream ();
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Compute size of the buffer based on rate and recovery interval.
|
// Compute size of the buffer based on rate and recovery interval.
|
||||||
int compute_sqns (int tpdu_);
|
int compute_sqns (int tpdu_);
|
||||||
|
|
||||||
// OpenPGM transport.
|
// OpenPGM transport.
|
||||||
pgm_sock_t* sock;
|
pgm_sock_t* sock;
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Associated socket options.
|
// Associated socket options.
|
||||||
options_t options;
|
options_t options;
|
||||||
|
|
||||||
// true when pgm_socket should create receiving side.
|
// true when pgm_socket should create receiving side.
|
||||||
bool receiver;
|
bool receiver;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ namespace zmq
|
|||||||
|
|
||||||
// How many bytes were processed from last pgm socket read.
|
// How many bytes were processed from last pgm socket read.
|
||||||
size_t nbytes_processed;
|
size_t nbytes_processed;
|
||||||
|
|
||||||
// How many messages from pgm_msgv were already sent up.
|
// How many messages from pgm_msgv were already sent up.
|
||||||
size_t pgm_msgv_processed;
|
size_t pgm_msgv_processed;
|
||||||
};
|
};
|
||||||
|
@ -84,7 +84,7 @@ namespace zmq
|
|||||||
// Specifies the object to send events to.
|
// Specifies the object to send events to.
|
||||||
void set_event_sink (i_pipe_events *sink_);
|
void set_event_sink (i_pipe_events *sink_);
|
||||||
|
|
||||||
// Pipe endpoint can store an routing ID to be used by its clients.
|
// Pipe endpoint can store an routing ID to be used by its clients.
|
||||||
void set_routing_id (uint32_t routing_id_);
|
void set_routing_id (uint32_t routing_id_);
|
||||||
uint32_t get_routing_id ();
|
uint32_t get_routing_id ();
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ int zmq::router_t::xrecv (msg_t *msg_)
|
|||||||
prefetched = false;
|
prefetched = false;
|
||||||
}
|
}
|
||||||
more_in = msg_->flags () & msg_t::more ? true : false;
|
more_in = msg_->flags () & msg_t::more ? true : false;
|
||||||
|
|
||||||
if (!more_in) {
|
if (!more_in) {
|
||||||
if (terminate_current_in) {
|
if (terminate_current_in) {
|
||||||
current_in->terminate (true);
|
current_in->terminate (true);
|
||||||
|
@ -124,7 +124,7 @@ namespace zmq
|
|||||||
// algorithm. This value is the next ID to use (if not used already).
|
// algorithm. This value is the next ID to use (if not used already).
|
||||||
uint32_t next_rid;
|
uint32_t next_rid;
|
||||||
|
|
||||||
// If true, report EAGAIN to the caller instead of silently dropping
|
// If true, report EAGAIN to the caller instead of silently dropping
|
||||||
// the message targeting an unknown peer.
|
// the message targeting an unknown peer.
|
||||||
bool mandatory;
|
bool mandatory;
|
||||||
bool raw_socket;
|
bool raw_socket;
|
||||||
|
@ -104,8 +104,8 @@ void zmq::select_t::rm_fd (handle_t handle_)
|
|||||||
|
|
||||||
if (family_entry_it != current_family_entry_it) {
|
if (family_entry_it != current_family_entry_it) {
|
||||||
// Family is not currently being iterated and can be safely
|
// Family is not currently being iterated and can be safely
|
||||||
// modified in palce. So later it can be skipped withour re-verifying
|
// modified in-place. So later it can be skipped without
|
||||||
// its content.
|
// re-verifying its content.
|
||||||
fd_entries_t::iterator fd_entry_it;
|
fd_entries_t::iterator fd_entry_it;
|
||||||
for (fd_entry_it = family_entry.fd_entries.begin ();
|
for (fd_entry_it = family_entry.fd_entries.begin ();
|
||||||
fd_entry_it != family_entry.fd_entries.end (); ++fd_entry_it)
|
fd_entry_it != family_entry.fd_entries.end (); ++fd_entry_it)
|
||||||
@ -441,7 +441,7 @@ u_short zmq::select_t::get_fd_family (fd_t fd_)
|
|||||||
|
|
||||||
int type;
|
int type;
|
||||||
int type_length = sizeof(int);
|
int type_length = sizeof(int);
|
||||||
|
|
||||||
int rc = getsockopt(fd_, SOL_SOCKET, SO_TYPE, (char*) &type, &type_length);
|
int rc = getsockopt(fd_, SOL_SOCKET, SO_TYPE, (char*) &type, &type_length);
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
@ -453,11 +453,11 @@ u_short zmq::select_t::get_fd_family (fd_t fd_)
|
|||||||
// AF_INET and AF_INET6 can be mixed in select
|
// AF_INET and AF_INET6 can be mixed in select
|
||||||
// TODO: If proven otherwise, should simply return addr.sa_family
|
// TODO: If proven otherwise, should simply return addr.sa_family
|
||||||
if (rc != SOCKET_ERROR)
|
if (rc != SOCKET_ERROR)
|
||||||
return addr.ss_family == AF_INET6 ? AF_INET : addr.ss_family;
|
return addr.ss_family == AF_INET6 ? AF_INET : addr.ss_family;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AF_UNSPEC;
|
return AF_UNSPEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::select_t::family_entry_t::family_entry_t () :
|
zmq::select_t::family_entry_t::family_entry_t () :
|
||||||
|
@ -55,7 +55,7 @@ namespace zmq
|
|||||||
~server_t ();
|
~server_t ();
|
||||||
|
|
||||||
// Overrides of functions from socket_base_t.
|
// Overrides of functions from socket_base_t.
|
||||||
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
|
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
|
||||||
int xsend (zmq::msg_t *msg_);
|
int xsend (zmq::msg_t *msg_);
|
||||||
int xrecv (zmq::msg_t *msg_);
|
int xrecv (zmq::msg_t *msg_);
|
||||||
bool xhas_in ();
|
bool xhas_in ();
|
||||||
@ -72,7 +72,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Fair queueing object for inbound pipes.
|
// Fair queueing object for inbound pipes.
|
||||||
fq_t fq;
|
fq_t fq;
|
||||||
|
|
||||||
struct outpipe_t
|
struct outpipe_t
|
||||||
{
|
{
|
||||||
zmq::pipe_t *pipe;
|
zmq::pipe_t *pipe;
|
||||||
@ -82,11 +82,11 @@ namespace zmq
|
|||||||
// Outbound pipes indexed by the peer IDs.
|
// Outbound pipes indexed by the peer IDs.
|
||||||
typedef std::map <uint32_t, outpipe_t> outpipes_t;
|
typedef std::map <uint32_t, outpipe_t> outpipes_t;
|
||||||
outpipes_t outpipes;
|
outpipes_t outpipes;
|
||||||
|
|
||||||
// Routing IDs are generated. It's a simple increment and wrap-over
|
// Routing IDs are generated. It's a simple increment and wrap-over
|
||||||
// algorithm. This value is the next ID to use (if not used already).
|
// algorithm. This value is the next ID to use (if not used already).
|
||||||
uint32_t next_rid;
|
uint32_t next_rid;
|
||||||
|
|
||||||
server_t (const server_t&);
|
server_t (const server_t&);
|
||||||
const server_t &operator = (const server_t&);
|
const server_t &operator = (const server_t&);
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,7 @@ namespace zmq
|
|||||||
{
|
{
|
||||||
socket_base_t *socket;
|
socket_base_t *socket;
|
||||||
fd_t fd;
|
fd_t fd;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
short events;
|
short events;
|
||||||
} event_t;
|
} event_t;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace zmq
|
|||||||
bool check_tag ();
|
bool check_tag ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int rebuild ();
|
int rebuild ();
|
||||||
|
|
||||||
// Used to check whether the object is a socket_poller.
|
// Used to check whether the object is a socket_poller.
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
@ -90,7 +90,7 @@ namespace zmq
|
|||||||
typedef struct item_t {
|
typedef struct item_t {
|
||||||
socket_base_t *socket;
|
socket_base_t *socket;
|
||||||
fd_t fd;
|
fd_t fd;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
short events;
|
short events;
|
||||||
#if defined ZMQ_POLL_BASED_ON_POLL
|
#if defined ZMQ_POLL_BASED_ON_POLL
|
||||||
int pollfd_index;
|
int pollfd_index;
|
||||||
@ -106,10 +106,10 @@ namespace zmq
|
|||||||
|
|
||||||
// Should the signaler be used for the thread safe polling?
|
// Should the signaler be used for the thread safe polling?
|
||||||
bool use_signaler;
|
bool use_signaler;
|
||||||
|
|
||||||
// Size of the pollset
|
// Size of the pollset
|
||||||
int poll_size;
|
int poll_size;
|
||||||
|
|
||||||
#if defined ZMQ_POLL_BASED_ON_POLL
|
#if defined ZMQ_POLL_BASED_ON_POLL
|
||||||
pollfd *pollfds;
|
pollfd *pollfds;
|
||||||
#elif defined ZMQ_POLL_BASED_ON_SELECT
|
#elif defined ZMQ_POLL_BASED_ON_SELECT
|
||||||
@ -118,7 +118,7 @@ namespace zmq
|
|||||||
fd_set pollset_err;
|
fd_set pollset_err;
|
||||||
zmq::fd_t maxfd;
|
zmq::fd_t maxfd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
socket_poller_t (const socket_poller_t&);
|
socket_poller_t (const socket_poller_t&);
|
||||||
const socket_poller_t &operator = (const socket_poller_t&);
|
const socket_poller_t &operator = (const socket_poller_t&);
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ namespace zmq
|
|||||||
void xread_activated (zmq::pipe_t *pipe_);
|
void xread_activated (zmq::pipe_t *pipe_);
|
||||||
void xwrite_activated (zmq::pipe_t *pipe_);
|
void xwrite_activated (zmq::pipe_t *pipe_);
|
||||||
void xpipe_terminated (zmq::pipe_t *pipe_);
|
void xpipe_terminated (zmq::pipe_t *pipe_);
|
||||||
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
|
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
|
||||||
private:
|
private:
|
||||||
// Generate peer's id and update lookup map
|
// Generate peer's id and update lookup map
|
||||||
void identify_peer (pipe_t *pipe_);
|
void identify_peer (pipe_t *pipe_);
|
||||||
|
@ -62,4 +62,4 @@ namespace zmq
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,7 +75,7 @@ namespace zmq
|
|||||||
// they would not be accessible from the main C routine of the thread.
|
// they would not be accessible from the main C routine of the thread.
|
||||||
thread_fn *tfn;
|
thread_fn *tfn;
|
||||||
void *arg;
|
void *arg;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
|
@ -479,7 +479,7 @@ int crypto_scalarmult(u8 *q,const u8 *n,const u8 *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int crypto_scalarmult_base(u8 *q,const u8 *n)
|
int crypto_scalarmult_base(u8 *q,const u8 *n)
|
||||||
{
|
{
|
||||||
return crypto_scalarmult(q,n,_9);
|
return crypto_scalarmult(q,n,_9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ static u64 Sigma1(u64 x) { return R(x,14) ^ R(x,18) ^ R(x,41); }
|
|||||||
static u64 sigma0(u64 x) { return R(x, 1) ^ R(x, 8) ^ (x >> 7); }
|
static u64 sigma0(u64 x) { return R(x, 1) ^ R(x, 8) ^ (x >> 7); }
|
||||||
static u64 sigma1(u64 x) { return R(x,19) ^ R(x,61) ^ (x >> 6); }
|
static u64 sigma1(u64 x) { return R(x,19) ^ R(x,61) ^ (x >> 6); }
|
||||||
|
|
||||||
static const u64 K[80] =
|
static const u64 K[80] =
|
||||||
{
|
{
|
||||||
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
|
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
|
||||||
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
|
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
|
||||||
@ -624,7 +624,7 @@ int crypto_hash(u8 *out,const u8 *m,u64 n)
|
|||||||
sv add(gf p[4],gf q[4])
|
sv add(gf p[4],gf q[4])
|
||||||
{
|
{
|
||||||
gf a,b,c,d,t,e,f,g,h;
|
gf a,b,c,d,t,e,f,g,h;
|
||||||
|
|
||||||
Z(a, p[1], p[0]);
|
Z(a, p[1], p[0]);
|
||||||
Z(t, q[1], q[0]);
|
Z(t, q[1], q[0]);
|
||||||
M(a, a, t);
|
M(a, a, t);
|
||||||
@ -656,7 +656,7 @@ sv cswap(gf p[4],gf q[4],u8 b)
|
|||||||
sv pack(u8 *r,gf p[4])
|
sv pack(u8 *r,gf p[4])
|
||||||
{
|
{
|
||||||
gf tx, ty, zi;
|
gf tx, ty, zi;
|
||||||
inv25519(zi, p[2]);
|
inv25519(zi, p[2]);
|
||||||
M(tx, p[0], zi);
|
M(tx, p[0], zi);
|
||||||
M(ty, p[1], zi);
|
M(ty, p[1], zi);
|
||||||
pack25519(r, ty);
|
pack25519(r, ty);
|
||||||
|
@ -105,13 +105,13 @@ int zmq::xsub_t::xsend (msg_t *msg_)
|
|||||||
subscriptions.add (data + 1, size - 1);
|
subscriptions.add (data + 1, size - 1);
|
||||||
return dist.send_to_all (msg_);
|
return dist.send_to_all (msg_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (size > 0 && *data == 0) {
|
if (size > 0 && *data == 0) {
|
||||||
// Process unsubscribe message
|
// Process unsubscribe message
|
||||||
if (subscriptions.rm (data + 1, size - 1))
|
if (subscriptions.rm (data + 1, size - 1))
|
||||||
return dist.send_to_all (msg_);
|
return dist.send_to_all (msg_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// User message sent upstream to XPUB socket
|
// User message sent upstream to XPUB socket
|
||||||
return dist.send_to_all (msg_);
|
return dist.send_to_all (msg_);
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ int zmq::xsub_t::xrecv (msg_t *msg_)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Check whether the message matches at least one subscription.
|
// Check whether the message matches at least one subscription.
|
||||||
// Non-initial parts of the message are passed
|
// Non-initial parts of the message are passed
|
||||||
if (more || !options.filter || match (msg_)) {
|
if (more || !options.filter || match (msg_)) {
|
||||||
more = msg_->flags () & msg_t::more ? true : false;
|
more = msg_->flags () & msg_t::more ? true : false;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -94,24 +94,24 @@ void zmq_threadclose(void* thread)
|
|||||||
// Maps base 256 to base 85
|
// Maps base 256 to base 85
|
||||||
static char encoder [85 + 1] = {
|
static char encoder [85 + 1] = {
|
||||||
"0123456789" "abcdefghij" "klmnopqrst" "uvwxyzABCD"
|
"0123456789" "abcdefghij" "klmnopqrst" "uvwxyzABCD"
|
||||||
"EFGHIJKLMN" "OPQRSTUVWX" "YZ.-:+=^!/" "*?&<>()[]{"
|
"EFGHIJKLMN" "OPQRSTUVWX" "YZ.-:+=^!/" "*?&<>()[]{"
|
||||||
"}@%$#"
|
"}@%$#"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Maps base 85 to base 256
|
// Maps base 85 to base 256
|
||||||
// We chop off lower 32 and higher 128 ranges
|
// We chop off lower 32 and higher 128 ranges
|
||||||
static uint8_t decoder [96] = {
|
static uint8_t decoder [96] = {
|
||||||
0x00, 0x44, 0x00, 0x54, 0x53, 0x52, 0x48, 0x00,
|
0x00, 0x44, 0x00, 0x54, 0x53, 0x52, 0x48, 0x00,
|
||||||
0x4B, 0x4C, 0x46, 0x41, 0x00, 0x3F, 0x3E, 0x45,
|
0x4B, 0x4C, 0x46, 0x41, 0x00, 0x3F, 0x3E, 0x45,
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x40, 0x00, 0x49, 0x42, 0x4A, 0x47,
|
0x08, 0x09, 0x40, 0x00, 0x49, 0x42, 0x4A, 0x47,
|
||||||
0x51, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A,
|
0x51, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A,
|
||||||
0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
|
0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
|
||||||
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
|
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
|
||||||
0x3B, 0x3C, 0x3D, 0x4D, 0x00, 0x4E, 0x43, 0x00,
|
0x3B, 0x3C, 0x3D, 0x4D, 0x00, 0x4E, 0x43, 0x00,
|
||||||
0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
|
0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
|
||||||
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
|
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
|
||||||
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
|
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
|
||||||
0x21, 0x22, 0x23, 0x4F, 0x00, 0x50, 0x00, 0x00
|
0x21, 0x22, 0x23, 0x4F, 0x00, 0x50, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Decode an encoded string into a binary frame; dest must be at least
|
// Decode an encoded string into a binary frame; dest must be at least
|
||||||
// strlen (string) * 4 / 5 bytes long. Returns dest. strlen (string)
|
// strlen (string) * 4 / 5 bytes long. Returns dest. strlen (string)
|
||||||
// must be a multiple of 5.
|
// must be a multiple of 5.
|
||||||
// Returns NULL and sets errno = EINVAL for invalid input.
|
// Returns NULL and sets errno = EINVAL for invalid input.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user