From 202d800ae7fa28b80ee047bed157e08a8afcc4f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 26 Apr 2013 07:13:07 +0200 Subject: [PATCH] Add methods to close the connection. --- src/main/java/net/pterodactylus/irc/Connection.java | 10 ++++++++++ src/main/java/net/pterodactylus/xdcc/core/Core.java | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index 530b0c7..ac29809 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -278,6 +278,16 @@ public class Connection extends AbstractExecutionThreadService implements Servic connectionHandler.sendCommand("PRIVMSG", recipient, String.format("\u0001DCC RESUME %s %d %d\u0001", filename, port, position)); } + /** + * Closes this connection. + * + * @throws IOException + * if an I/O error occurs + */ + public void close() throws IOException { + connectionHandler.close(); + } + // // ABSTRACTEXECUTIONTHREADSERVICE METHODS // diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index d89f807..5b883db 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -249,6 +249,20 @@ public class Core extends AbstractExecutionThreadService { } } + /** + * Closes the given connection. + * + * @param connection + * The connection to close + */ + public void closeConnection(Connection connection) { + try { + connection.close(); + } catch (IOException ioe1) { + /* TODO */ + } + } + // // ABSTRACTIDLESERVICE METHODS // -- 2.7.4