Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
2a5fb6cb
Commit
2a5fb6cb
authored
6 years ago
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: ipc_listener_t data members not conforming to naming style
Solution: add underscore prefix
parent
7e735877
master
v4.3.2
v4.3.2-win
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
50 deletions
+50
-50
ipc_listener.cpp
src/ipc_listener.cpp
+43
-43
ipc_listener.hpp
src/ipc_listener.hpp
+7
-7
No files found.
src/ipc_listener.cpp
View file @
2a5fb6cb
...
...
@@ -134,28 +134,28 @@ zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
const
options_t
&
options_
)
:
own_t
(
io_thread_
,
options_
),
io_object_t
(
io_thread_
),
has_file
(
false
),
s
(
retired_fd
),
handle
(
static_cast
<
handle_t
>
(
NULL
)),
socket
(
socket_
)
_
has_file
(
false
),
_
s
(
retired_fd
),
_
handle
(
static_cast
<
handle_t
>
(
NULL
)),
_
socket
(
socket_
)
{
}
zmq
::
ipc_listener_t
::~
ipc_listener_t
()
{
zmq_assert
(
s
==
retired_fd
);
zmq_assert
(
_
s
==
retired_fd
);
}
void
zmq
::
ipc_listener_t
::
process_plug
()
{
// Start polling for incoming connections.
handle
=
add_fd
(
s
);
set_pollin
(
handle
);
_handle
=
add_fd
(
_
s
);
set_pollin
(
_
handle
);
}
void
zmq
::
ipc_listener_t
::
process_term
(
int
linger_
)
{
rm_fd
(
handle
);
rm_fd
(
_
handle
);
close
();
own_t
::
process_term
(
linger_
);
}
...
...
@@ -167,13 +167,13 @@ void zmq::ipc_listener_t::in_event ()
// If connection was reset by the peer in the meantime, just ignore it.
// TODO: Handle specific errors like ENFILE/EMFILE etc.
if
(
fd
==
retired_fd
)
{
socket
->
event_accept_failed
(
endpoint
,
zmq_errno
());
_socket
->
event_accept_failed
(
_
endpoint
,
zmq_errno
());
return
;
}
// Create the engine object for this connection.
stream_engine_t
*
engine
=
new
(
std
::
nothrow
)
stream_engine_t
(
fd
,
options
,
endpoint
);
new
(
std
::
nothrow
)
stream_engine_t
(
fd
,
options
,
_
endpoint
);
alloc_assert
(
engine
);
// Choose I/O thread to run connecter in. Given that we are already
...
...
@@ -183,12 +183,12 @@ void zmq::ipc_listener_t::in_event ()
// Create and launch a session object.
session_base_t
*
session
=
session_base_t
::
create
(
io_thread
,
false
,
socket
,
options
,
NULL
);
session_base_t
::
create
(
io_thread
,
false
,
_
socket
,
options
,
NULL
);
errno_assert
(
session
);
session
->
inc_seqnum
();
launch_child
(
session
);
send_attach
(
session
,
engine
,
false
);
socket
->
event_accepted
(
endpoint
,
fd
);
_socket
->
event_accepted
(
_
endpoint
,
fd
);
}
int
zmq
::
ipc_listener_t
::
get_address
(
std
::
string
&
addr_
)
...
...
@@ -199,7 +199,7 @@ int zmq::ipc_listener_t::get_address (std::string &addr_)
#else
socklen_t
sl
=
sizeof
(
ss
);
#endif
int
rc
=
getsockname
(
s
,
reinterpret_cast
<
sockaddr
*>
(
&
ss
),
&
sl
);
int
rc
=
getsockname
(
_
s
,
reinterpret_cast
<
sockaddr
*>
(
&
ss
),
&
sl
);
if
(
rc
!=
0
)
{
addr_
.
clear
();
return
rc
;
...
...
@@ -216,7 +216,7 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
// Allow wildcard file
if
(
options
.
use_fd
==
-
1
&&
addr
[
0
]
==
'*'
)
{
if
(
create_wildcard_address
(
tmp_socket_dirname
,
addr
)
<
0
)
{
if
(
create_wildcard_address
(
_
tmp_socket_dirname
,
addr
)
<
0
)
{
return
-
1
;
}
}
...
...
@@ -229,56 +229,56 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
if
(
options
.
use_fd
==
-
1
)
{
::
unlink
(
addr
.
c_str
());
}
filename
.
clear
();
_
filename
.
clear
();
// Initialise the address structure.
ipc_address_t
address
;
int
rc
=
address
.
resolve
(
addr
.
c_str
());
if
(
rc
!=
0
)
{
if
(
!
tmp_socket_dirname
.
empty
())
{
if
(
!
_
tmp_socket_dirname
.
empty
())
{
// We need to preserve errno to return to the user
int
tmp_errno
=
errno
;
::
rmdir
(
tmp_socket_dirname
.
c_str
());
tmp_socket_dirname
.
clear
();
::
rmdir
(
_
tmp_socket_dirname
.
c_str
());
_
tmp_socket_dirname
.
clear
();
errno
=
tmp_errno
;
}
return
-
1
;
}
address
.
to_string
(
endpoint
);
address
.
to_string
(
_
endpoint
);
if
(
options
.
use_fd
!=
-
1
)
{
s
=
options
.
use_fd
;
_
s
=
options
.
use_fd
;
}
else
{
// Create a listening socket.
s
=
open_socket
(
AF_UNIX
,
SOCK_STREAM
,
0
);
if
(
s
==
-
1
)
{
if
(
!
tmp_socket_dirname
.
empty
())
{
_
s
=
open_socket
(
AF_UNIX
,
SOCK_STREAM
,
0
);
if
(
_
s
==
-
1
)
{
if
(
!
_
tmp_socket_dirname
.
empty
())
{
// We need to preserve errno to return to the user
int
tmp_errno
=
errno
;
::
rmdir
(
tmp_socket_dirname
.
c_str
());
tmp_socket_dirname
.
clear
();
::
rmdir
(
_
tmp_socket_dirname
.
c_str
());
_
tmp_socket_dirname
.
clear
();
errno
=
tmp_errno
;
}
return
-
1
;
}
// Bind the socket to the file path.
rc
=
bind
(
s
,
const_cast
<
sockaddr
*>
(
address
.
addr
()),
rc
=
bind
(
_
s
,
const_cast
<
sockaddr
*>
(
address
.
addr
()),
address
.
addrlen
());
if
(
rc
!=
0
)
goto
error
;
// Listen for incoming connections.
rc
=
listen
(
s
,
options
.
backlog
);
rc
=
listen
(
_
s
,
options
.
backlog
);
if
(
rc
!=
0
)
goto
error
;
}
filename
=
ZMQ_MOVE
(
addr
);
has_file
=
true
;
_
filename
=
ZMQ_MOVE
(
addr
);
_
has_file
=
true
;
socket
->
event_listening
(
endpoint
,
s
);
_socket
->
event_listening
(
_endpoint
,
_
s
);
return
0
;
error
:
...
...
@@ -290,28 +290,28 @@ error:
int
zmq
::
ipc_listener_t
::
close
()
{
zmq_assert
(
s
!=
retired_fd
);
int
fd_for_event
=
s
;
int
rc
=
::
close
(
s
);
zmq_assert
(
_
s
!=
retired_fd
);
int
fd_for_event
=
_
s
;
int
rc
=
::
close
(
_
s
);
errno_assert
(
rc
==
0
);
s
=
retired_fd
;
_
s
=
retired_fd
;
if
(
has_file
&&
options
.
use_fd
==
-
1
)
{
if
(
_
has_file
&&
options
.
use_fd
==
-
1
)
{
rc
=
0
;
if
(
rc
==
0
&&
!
tmp_socket_dirname
.
empty
())
{
rc
=
::
rmdir
(
tmp_socket_dirname
.
c_str
());
tmp_socket_dirname
.
clear
();
if
(
rc
==
0
&&
!
_
tmp_socket_dirname
.
empty
())
{
rc
=
::
rmdir
(
_
tmp_socket_dirname
.
c_str
());
_
tmp_socket_dirname
.
clear
();
}
if
(
rc
!=
0
)
{
socket
->
event_close_failed
(
endpoint
,
zmq_errno
());
_socket
->
event_close_failed
(
_
endpoint
,
zmq_errno
());
return
-
1
;
}
}
socket
->
event_closed
(
endpoint
,
fd_for_event
);
_socket
->
event_closed
(
_
endpoint
,
fd_for_event
);
return
0
;
}
...
...
@@ -389,11 +389,11 @@ zmq::fd_t zmq::ipc_listener_t::accept ()
// Accept one connection and deal with different failure modes.
// The situation where connection cannot be accepted due to insufficient
// resources is considered valid and treated by ignoring the connection.
zmq_assert
(
s
!=
retired_fd
);
zmq_assert
(
_
s
!=
retired_fd
);
#if defined ZMQ_HAVE_SOCK_CLOEXEC && defined HAVE_ACCEPT4
fd_t
sock
=
::
accept4
(
s
,
NULL
,
NULL
,
SOCK_CLOEXEC
);
fd_t
sock
=
::
accept4
(
_
s
,
NULL
,
NULL
,
SOCK_CLOEXEC
);
#else
fd_t
sock
=
::
accept
(
s
,
NULL
,
NULL
);
fd_t
sock
=
::
accept
(
_
s
,
NULL
,
NULL
);
#endif
if
(
sock
==
-
1
)
{
errno_assert
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
||
errno
==
EINTR
...
...
This diff is collapsed.
Click to expand it.
src/ipc_listener.hpp
View file @
2a5fb6cb
...
...
@@ -85,26 +85,26 @@ class ipc_listener_t : public own_t, public io_object_t
fd_t
accept
();
// True, if the underlying file for UNIX domain socket exists.
bool
has_file
;
bool
_
has_file
;
// Name of the temporary directory (if any) that has the
// the UNIX domain socket
std
::
string
tmp_socket_dirname
;
std
::
string
_
tmp_socket_dirname
;
// Name of the file associated with the UNIX domain address.
std
::
string
filename
;
std
::
string
_
filename
;
// Underlying socket.
fd_t
s
;
fd_t
_
s
;
// Handle corresponding to the listening socket.
handle_t
handle
;
handle_t
_
handle
;
// Socket the listener belongs to.
zmq
::
socket_base_t
*
socket
;
zmq
::
socket_base_t
*
_
socket
;
// String representation of endpoint to bind to
std
::
string
endpoint
;
std
::
string
_
endpoint
;
// Acceptable temporary directory environment variables
static
const
char
*
tmp_env_vars
[];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment