From bca41a681f499cfe7b3ce4969752b359fdb2b15e Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Sat, 30 Apr 2016 10:50:42 -0700 Subject: [PATCH] update comments regarding converting shared_ptr to unique_ptr --- include/libtorrent/aux_/session_impl.hpp | 3 ++- include/libtorrent/tracker_manager.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 969e1ae40..a3755dc0e 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -166,7 +166,8 @@ namespace libtorrent // the actual sockets (TCP listen socket and UDP socket) // An entry does not necessarily have a UDP or TCP socket. One of these // pointers may be null! - // TODO: 3 make these unique_ptr<> + // These must be shared_ptr to avoid a dangling reference if an + // incoming packet is in the event queue when the socket is erased boost::shared_ptr sock; boost::shared_ptr udp_sock; }; diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index 6f9949438..4527f1701 100644 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -401,7 +401,8 @@ namespace libtorrent mutable std::mutex m_mutex; // maps transactionid to the udp_tracker_connection - // TODO: this should be unique_ptr in the future + // These must use shared_ptr to avoid a dangling reference + // if a connection is erased while a timeout event is in the queue typedef boost::unordered_map > udp_conns_t; udp_conns_t m_udp_conns;