Add methods to close the connection.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Apr 2013 05:13:07 +0000 (07:13 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Apr 2013 05:13:07 +0000 (07:13 +0200)
src/main/java/net/pterodactylus/irc/Connection.java
src/main/java/net/pterodactylus/xdcc/core/Core.java

index 530b0c7..ac29809 100644 (file)
@@ -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
        //
index d89f807..5b883db 100644 (file)
@@ -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
        //