Prevent NPEs when the download hasn’t started yet.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / core / Core.java
index d89f807..6af2f73 100644 (file)
@@ -147,6 +147,15 @@ public class Core extends AbstractExecutionThreadService {
        //
 
        /**
+        * Returns all currently known connections.
+        *
+        * @return All currently known connections
+        */
+       public Collection<Connection> connections() {
+               return networkConnections.values();
+       }
+
+       /**
         * Returns all configured channels. Due to various circumstances, configured
         * channels might not actually be joined.
         *
@@ -249,6 +258,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
        //