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
75d67286
Commit
75d67286
authored
Jun 13, 2012
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{tcp|ipc}_listener: close socket when set_address () fails
parent
a9507cc2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
ipc_listener.cpp
src/ipc_listener.cpp
+8
-2
tcp_listener.cpp
src/tcp_listener.cpp
+10
-4
No files found.
src/ipc_listener.cpp
View file @
75d67286
...
...
@@ -145,7 +145,7 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
// Bind the socket to the file path.
rc
=
bind
(
s
,
address
.
addr
(),
address
.
addrlen
());
if
(
rc
!=
0
)
return
-
1
;
goto
error
;
filename
.
assign
(
addr_
);
has_file
=
true
;
...
...
@@ -153,10 +153,16 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
// Listen for incomming connections.
rc
=
listen
(
s
,
options
.
backlog
);
if
(
rc
!=
0
)
return
-
1
;
goto
error
;
socket
->
monitor_event
(
ZMQ_EVENT_LISTENING
,
addr_
,
s
);
return
0
;
error
:
int
err
=
errno
;
close
();
errno
=
err
;
return
-
1
;
}
int
zmq
::
ipc_listener_t
::
close
()
...
...
src/tcp_listener.cpp
View file @
75d67286
...
...
@@ -208,11 +208,11 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
#ifdef ZMQ_HAVE_WINDOWS
if
(
rc
==
SOCKET_ERROR
)
{
errno
=
wsa_error_to_errno
(
WSAGetLastError
());
return
-
1
;
goto
error
;
}
#else
if
(
rc
!=
0
)
return
-
1
;
goto
error
;
#endif
// Listen for incomming connections.
...
...
@@ -220,15 +220,21 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
#ifdef ZMQ_HAVE_WINDOWS
if
(
rc
==
SOCKET_ERROR
)
{
errno
=
wsa_error_to_errno
(
WSAGetLastError
());
return
-
1
;
goto
error
;
}
#else
if
(
rc
!=
0
)
return
-
1
;
goto
error
;
#endif
socket
->
monitor_event
(
ZMQ_EVENT_LISTENING
,
addr_
,
s
);
return
0
;
error
:
int
err
=
errno
;
close
();
errno
=
err
;
return
-
1
;
}
zmq
::
fd_t
zmq
::
tcp_listener_t
::
accept
()
...
...
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