Skip to content

Commit

Permalink
Merge pull request ros#531 from ros/remove_queued_connections_correctly
Browse files Browse the repository at this point in the history
fix removal of QueuedConnection leading to wrong subscriber count
  • Loading branch information
dirk-thomas committed Dec 10, 2014
2 parents 66560f6 + 270173f commit 6868cbf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clients/rospy/src/rospy/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,17 @@ def _remove_connection(self, connections, c):
c.close()
except:
pass
# while c might be a rospy.impl.tcpros_base.TCPROSTransport instance
# connections might only contain the rospy.impl.tcpros_pubsub.QueuedConnection proxy
# finding the "right" connection is more difficult then
if c in connections:
connections.remove(c)
# therefore additionally check for fileno equality if available
elif c.fileno():
matching_connections = [
conn for conn in connections if conn.fileno() == c.fileno()]
if len(matching_connections) == 1:
connections.remove(matching_connections[0])

def add_connection(self, c):
"""
Expand Down

0 comments on commit 6868cbf

Please sign in to comment.