From b188a5d4f66c1bc99d5e9695f97fe317393da931 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 16 May 2008 13:18:44 +0000 Subject: [PATCH] set fcp connection to null if connection failed git-svn-id: http://trooper/svn/projects/jFCPlib/branch/high-level-client@890 c3eda9e8-030b-0410-8277-bc7414b0a119 --- .../pterodactylus/fcp/highlevel/HighLevelClient.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java index a347e68..93378d3 100644 --- a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java +++ b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java @@ -303,13 +303,18 @@ public class HighLevelClient { * if an I/O error occurs communicating with the node */ public HighLevelCallback connect(InetAddress address, int port) throws IOException { - fcpConnection = new FcpConnection(address, port); - fcpConnection.addFcpListener(highLevelClientFcpListener); - fcpConnection.connect(); - ClientHello clientHello = new ClientHello(clientName); - connectCallback = new HighLevelCallback(new ConnectResult()); - fcpConnection.sendMessage(clientHello); - return connectCallback; + try { + fcpConnection = new FcpConnection(address, port); + fcpConnection.addFcpListener(highLevelClientFcpListener); + fcpConnection.connect(); + ClientHello clientHello = new ClientHello(clientName); + connectCallback = new HighLevelCallback(new ConnectResult()); + fcpConnection.sendMessage(clientHello); + return connectCallback; + } catch (IOException ioe1) { + fcpConnection = null; + throw ioe1; + } } /** -- 2.7.4