From 286e4242b32143725bc1a20400efbf5f73e0045c Mon Sep 17 00:00:00 2001 From: Timothy Fike Date: Tue, 21 Jun 2016 21:39:46 -0400 Subject: [PATCH] This can sometimes throw on server restart, but the error is not useful. --- .../nodebbintegration/socketio/SocketIOClient.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/radiofreederp/nodebbintegration/socketio/SocketIOClient.java b/common/src/main/java/com/radiofreederp/nodebbintegration/socketio/SocketIOClient.java index d3e75f4..be14a97 100644 --- a/common/src/main/java/com/radiofreederp/nodebbintegration/socketio/SocketIOClient.java +++ b/common/src/main/java/com/radiofreederp/nodebbintegration/socketio/SocketIOClient.java @@ -50,7 +50,13 @@ private static boolean hasSocket() { public static void connect() { instance.connectSocket(); } public static boolean connected() { return hasSocket() && instance.socket.connected(); } public static boolean disconnected() { return !connected(); } - public static void close() { if (hasSocket()) instance.socket.close(); } + public static void close() { + if (hasSocket()) { + try { + instance.socket.close(); + } catch (Exception ignored) {} + } + } public static void emit(final String event, final JSONObject data, final Ack ack) { if (connected()) instance.socket.emit(instance.namespace + event, data, new Ack() {