[vlma-devel] commit: Fix socket leak. (Adrien Grand )

git version control git at videolan.org
Wed Feb 4 04:10:52 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Wed Feb  4 04:06:19 2009 +0100| [7a79863bcafaa20723d8157b093ca669f318717f] | committer: Adrien Grand 

Fix socket leak.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=7a79863bcafaa20723d8157b093ca669f318717f
---

 .../vlma/order/management/OrderManager.java        |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
index 524acd4..e7cf833 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
@@ -237,6 +237,7 @@ public class OrderManager {
             // Can happen if one server which is not up has orders to stop
             if (server == null) return;
             TelnetConnection conn = null;
+            logger.debug("Sending orders to " + server.getName());
             try {
                 conn = orderSender.getConn(server);
                 for(Order order : ordersToStop) {
@@ -253,10 +254,15 @@ public class OrderManager {
                 }
             } catch (IOException e) {
                 logger.error("Error while trying to send an order to " + server.getName(), e);
+            } finally {
                 if (conn != null) {
                     try {
+                        logger.debug("Closing socket to " + server.getName());
                         conn.close();
-                    } catch (IOException e1) {}
+                        logger.debug("Socket closed (" + server.getName() + ")");
+                    } catch (IOException e1) {
+                        logger.debug("Error while closing connection", e1);
+                    }
                 }
             }
         }



More information about the vlma-devel mailing list