From 43021dab66b89867961d48e13ad7c8e8e9e50969 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 11 Apr 2008 06:58:37 +0000 Subject: [PATCH] add disconnect handling git-svn-id: http://trooper/svn/projects/jSite/trunk@709 c3eda9e8-030b-0410-8277-bc7414b0a119 --- src/net/pterodactylus/util/fcp/FcpConnection.java | 10 ++++++++++ src/net/pterodactylus/util/fcp/FcpConnectionHandler.java | 1 + 2 files changed, 11 insertions(+) diff --git a/src/net/pterodactylus/util/fcp/FcpConnection.java b/src/net/pterodactylus/util/fcp/FcpConnection.java index d5f05ee..d8c9698 100644 --- a/src/net/pterodactylus/util/fcp/FcpConnection.java +++ b/src/net/pterodactylus/util/fcp/FcpConnection.java @@ -534,6 +534,16 @@ public class FcpConnection { } } + /** + * Handles a disconnect from the node. + */ + synchronized void handleDisconnect() { + Closer.close(remoteInputStream); + Closer.close(remoteOutputStream); + Closer.close(remoteSocket); + connectionHandler = null; + } + // // PRIVATE METHODS // diff --git a/src/net/pterodactylus/util/fcp/FcpConnectionHandler.java b/src/net/pterodactylus/util/fcp/FcpConnectionHandler.java index 67dd65e..8594c79 100644 --- a/src/net/pterodactylus/util/fcp/FcpConnectionHandler.java +++ b/src/net/pterodactylus/util/fcp/FcpConnectionHandler.java @@ -100,6 +100,7 @@ public class FcpConnectionHandler implements Runnable { break; } } + fcpConnection.handleDisconnect(); } /** -- 2.7.4