From 3ed38059aa745dc46ccd4e368e943a58a9d48601 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 8 Nov 2008 21:44:24 +0000 Subject: [PATCH] rate_limited_udp_socket fixes --- include/libtorrent/udp_socket.hpp | 1 + src/udp_socket.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libtorrent/udp_socket.hpp b/include/libtorrent/udp_socket.hpp index 85ae0af88..0b7c447ae 100644 --- a/include/libtorrent/udp_socket.hpp +++ b/include/libtorrent/udp_socket.hpp @@ -120,6 +120,7 @@ namespace libtorrent void set_rate_limit(int limit) { m_rate_limit = limit; } bool can_send() const { return int(m_queue.size()) >= m_queue_size_limit; } bool send(udp::endpoint const& ep, char const* p, int len, error_code& ec); + void close(); private: struct queued_packet diff --git a/src/udp_socket.cpp b/src/udp_socket.cpp index 859608d8d..e29d8d755 100644 --- a/src/udp_socket.cpp +++ b/src/udp_socket.cpp @@ -588,3 +588,9 @@ void rate_limited_udp_socket::on_tick(error_code const& e) } } +void rate_limited_udp_socket::close() +{ + m_timer.cancel(); + udp_socket::close(); +} +