From adfc43d81b1411383323e706310a83fefaf34321 Mon Sep 17 00:00:00 2001 From: "andrey.kirichenko" Date: Mon, 14 Jan 2019 18:58:33 +0300 Subject: [PATCH] Fixed deadlock on disconnect datagramSocket --- .../connectsdk/discovery/provider/ssdp/SSDPClient.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/connectsdk/discovery/provider/ssdp/SSDPClient.java b/src/com/connectsdk/discovery/provider/ssdp/SSDPClient.java index 234e2528..1f7d8e8a 100644 --- a/src/com/connectsdk/discovery/provider/ssdp/SSDPClient.java +++ b/src/com/connectsdk/discovery/provider/ssdp/SSDPClient.java @@ -132,8 +132,12 @@ public void close() { } if (datagramSocket != null) { - datagramSocket.disconnect(); - datagramSocket.close(); + if (datagramSocket.isConnected()) { + datagramSocket.disconnect(); + } + if (!datagramSocket.isClosed()) { + datagramSocket.close(); + } } }