changeset 2347:0bda20126372

6946825: com.sun.net.httpserver.HttpServer; Memory Leak on Non HTTP conform open socket Reviewed-by: michaelm
author chegar
date Thu, 06 May 2010 17:17:09 +0100
parents 8834c3633f0b
children a6928350e1f2
files src/share/classes/sun/net/httpserver/ServerImpl.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/net/httpserver/ServerImpl.java	Thu May 06 13:42:52 2010 +0800
+++ b/src/share/classes/sun/net/httpserver/ServerImpl.java	Thu May 06 17:17:09 2010 +0100
@@ -451,6 +451,7 @@
                 if (requestLine == null) {
                     /* connection closed */
                     connection.close();
+                    allConnections.remove(connection);
                     return;
                 }
                 int space = requestLine.indexOf (' ');
@@ -592,6 +593,8 @@
             sendReply (
                 code, true, "<h1>"+code+Code.msg(code)+"</h1>"+message
             );
+            /* connection is already closed by sendReply, now remove it */
+            allConnections.remove(connection);
         }
 
         void sendReply (