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
eb8105cd
Commit
eb8105cd
authored
Aug 31, 2017
by
sigiesec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: assertion failure in select.cpp:111 under Windows
Solution: handle case when get_fd_family fails
parent
28a4b9a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
select.cpp
src/select.cpp
+31
-8
select.hpp
src/select.hpp
+3
-0
No files found.
src/select.cpp
View file @
eb8105cd
...
...
@@ -99,22 +99,19 @@ zmq::select_t::find_fd_entry_by_handle (fd_entries_t &fd_entries,
++
fd_entry_it
)
if
(
fd_entry_it
->
fd
==
handle_
)
break
;
zmq_assert
(
fd_entry_it
!=
fd_entries
.
end
());
return
fd_entry_it
;
}
void
zmq
::
select_t
::
rm_fd
(
handle_t
handle_
)
bool
zmq
::
select_t
::
try_remove_fd_entry
(
family_entries_t
::
iterator
family_entry_it
,
zmq
::
fd_t
&
handle_
)
{
#if defined ZMQ_HAVE_WINDOWS
u_short
family
=
get_fd_family
(
handle_
);
wsa_assert
(
family
!=
AF_UNSPEC
);
family_entries_t
::
iterator
family_entry_it
=
family_entries
.
find
(
family
);
family_entry_t
&
family_entry
=
family_entry_it
->
second
;
family_entry_t
&
family_entry
=
family_entry_it
->
second
;
fd_entries_t
::
iterator
fd_entry_it
=
find_fd_entry_by_handle
(
family_entry
.
fd_entries
,
handle_
);
if
(
fd_entry_it
==
family_entry
.
fd_entries
.
end
())
return
false
;
if
(
family_entry_it
!=
current_family_entry_it
)
{
// Family is not currently being iterated and can be safely
// modified in-place. So later it can be skipped without
...
...
@@ -127,9 +124,35 @@ void zmq::select_t::rm_fd (handle_t handle_)
family_entry
.
retired
=
true
;
}
family_entry
.
fds_set
.
remove_fd
(
handle_
);
return
true
;
}
void
zmq
::
select_t
::
rm_fd
(
handle_t
handle_
)
{
#if defined ZMQ_HAVE_WINDOWS
u_short
family
=
get_fd_family
(
handle_
);
if
(
family
!=
AF_UNSPEC
)
{
family_entries_t
::
iterator
family_entry_it
=
family_entries
.
find
(
family
);
int
removed
=
try_remove_fd_entry
(
family_entry_it
,
handle_
);
assert
(
removed
);
}
else
{
// get_fd_family may fail and return AF_UNSPEC if the socket was not
// successfully connected. In that case, we need to look for the
// socket in all family_entries.
family_entries_t
::
iterator
end
=
family_entries
.
end
();
for
(
family_entries_t
::
iterator
family_entry_it
=
family_entries
.
begin
();
family_entry_it
!=
end
;
++
family_entry_it
)
{
if
(
try_remove_fd_entry
(
family_entry_it
,
handle_
))
break
;
}
}
#else
fd_entries_t
::
iterator
fd_entry_it
=
find_fd_entry_by_handle
(
fd_entries
,
handle_
);
assert
(
fd_entry_it
!=
fd_entries
.
end
());
fd_entry_it
->
fd
=
retired_fd
;
fds_set
.
remove_fd
(
handle_
);
...
...
src/select.hpp
View file @
eb8105cd
...
...
@@ -137,6 +137,9 @@ namespace zmq
family_entries_t
family_entries
;
// See loop for details.
family_entries_t
::
iterator
current_family_entry_it
;
bool
try_remove_fd_entry
(
family_entries_t
::
iterator
family_entry_it
,
zmq
::
fd_t
&
handle_
);
#else
fd_entries_t
fd_entries
;
fds_set_t
fds_set
;
...
...
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