mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-30 21:50:49 +01:00
Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
This commit is contained in:
@@ -38,9 +38,9 @@
|
||||
|
||||
zmq::dgram_t::dgram_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
|
||||
socket_base_t (parent_, tid_, sid_),
|
||||
pipe (NULL),
|
||||
last_in (NULL),
|
||||
more_out (false)
|
||||
_pipe (NULL),
|
||||
_last_in (NULL),
|
||||
_more_out (false)
|
||||
{
|
||||
options.type = ZMQ_DGRAM;
|
||||
options.raw_socket = true;
|
||||
@@ -48,7 +48,7 @@ zmq::dgram_t::dgram_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
|
||||
|
||||
zmq::dgram_t::~dgram_t ()
|
||||
{
|
||||
zmq_assert (!pipe);
|
||||
zmq_assert (!_pipe);
|
||||
}
|
||||
|
||||
void zmq::dgram_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
||||
@@ -59,20 +59,20 @@ void zmq::dgram_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
||||
|
||||
// ZMQ_DGRAM socket can only be connected to a single peer.
|
||||
// The socket rejects any further connection requests.
|
||||
if (pipe == NULL)
|
||||
pipe = pipe_;
|
||||
if (_pipe == NULL)
|
||||
_pipe = pipe_;
|
||||
else
|
||||
pipe_->terminate (false);
|
||||
}
|
||||
|
||||
void zmq::dgram_t::xpipe_terminated (pipe_t *pipe_)
|
||||
{
|
||||
if (pipe_ == pipe) {
|
||||
if (last_in == pipe) {
|
||||
saved_credential.set_deep_copy (last_in->get_credential ());
|
||||
last_in = NULL;
|
||||
if (pipe_ == _pipe) {
|
||||
if (_last_in == _pipe) {
|
||||
_saved_credential.set_deep_copy (_last_in->get_credential ());
|
||||
_last_in = NULL;
|
||||
}
|
||||
pipe = NULL;
|
||||
_pipe = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void zmq::dgram_t::xwrite_activated (pipe_t *)
|
||||
int zmq::dgram_t::xsend (msg_t *msg_)
|
||||
{
|
||||
// If there's no out pipe, just drop it.
|
||||
if (!pipe) {
|
||||
if (!_pipe) {
|
||||
int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
return -1;
|
||||
@@ -99,14 +99,14 @@ int zmq::dgram_t::xsend (msg_t *msg_)
|
||||
|
||||
// If this is the first part of the message it's the ID of the
|
||||
// peer to send the message to.
|
||||
if (!more_out) {
|
||||
if (!_more_out) {
|
||||
if (!(msg_->flags () & msg_t::more)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Expect one more message frame.
|
||||
more_out = true;
|
||||
_more_out = true;
|
||||
} else {
|
||||
// dgram messages are two part only, reject part if more is set
|
||||
if (msg_->flags () & msg_t::more) {
|
||||
@@ -115,17 +115,17 @@ int zmq::dgram_t::xsend (msg_t *msg_)
|
||||
}
|
||||
|
||||
// This is the last part of the message.
|
||||
more_out = false;
|
||||
_more_out = false;
|
||||
}
|
||||
|
||||
// Push the message into the pipe.
|
||||
if (!pipe->write (msg_)) {
|
||||
if (!_pipe->write (msg_)) {
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(msg_->flags () & msg_t::more))
|
||||
pipe->flush ();
|
||||
_pipe->flush ();
|
||||
|
||||
// Detach the message from the data buffer.
|
||||
int rc = msg_->init ();
|
||||
@@ -140,7 +140,7 @@ int zmq::dgram_t::xrecv (msg_t *msg_)
|
||||
int rc = msg_->close ();
|
||||
errno_assert (rc == 0);
|
||||
|
||||
if (!pipe || !pipe->read (msg_)) {
|
||||
if (!_pipe || !_pipe->read (msg_)) {
|
||||
// Initialise the output parameter to be a 0-byte message.
|
||||
rc = msg_->init ();
|
||||
errno_assert (rc == 0);
|
||||
@@ -148,28 +148,28 @@ int zmq::dgram_t::xrecv (msg_t *msg_)
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
last_in = pipe;
|
||||
_last_in = _pipe;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool zmq::dgram_t::xhas_in ()
|
||||
{
|
||||
if (!pipe)
|
||||
if (!_pipe)
|
||||
return false;
|
||||
|
||||
return pipe->check_read ();
|
||||
return _pipe->check_read ();
|
||||
}
|
||||
|
||||
bool zmq::dgram_t::xhas_out ()
|
||||
{
|
||||
if (!pipe)
|
||||
if (!_pipe)
|
||||
return false;
|
||||
|
||||
return pipe->check_write ();
|
||||
return _pipe->check_write ();
|
||||
}
|
||||
|
||||
const zmq::blob_t &zmq::dgram_t::get_credential () const
|
||||
{
|
||||
return last_in ? last_in->get_credential () : saved_credential;
|
||||
return _last_in ? _last_in->get_credential () : _saved_credential;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user