From cc49a7fb157d47dee36ca01641e18d8cfbf02355 Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Tue, 27 Nov 2018 19:30:17 -0800 Subject: [PATCH] fix assertion when sending a udp packet to a closed socket This can happen particularly during shutdown. We should eventually get to a point where this doesn't happen, but since we close the sockets immediately upon initiating shutdown it's hard to avoid for now. --- src/session_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 4acdb1c83..d57bd8f19 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2306,7 +2306,7 @@ namespace aux { auto s = std::static_pointer_cast(si); - TORRENT_ASSERT(s->sock.local_endpoint().protocol() == ep.protocol()); + TORRENT_ASSERT(s->sock.is_closed() || s->sock.local_endpoint().protocol() == ep.protocol()); s->sock.send(ep, p, ec, flags);