Log exactly which part of the connection has died.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / Connection.java
index 8ea1a55..169bfa5 100644 (file)
@@ -56,8 +56,14 @@ public abstract class Connection implements Runnable {
        @Override
        public void run() {
                while (true) {
+                       byte[] buffer = null;
+                       try {
+                               buffer = source.get(bufferSize());
+                       } catch (IOException ioe1) {
+                               logger.log(Level.WARNING, "Source died!", ioe1);
+                               break;
+                       }
                        try {
-                               byte[] buffer = source.get(bufferSize());
                                feed(buffer);
                        } catch (IOException ioe1) {
                                logger.log(Level.WARNING, "Sink died!", ioe1);