Skip to content
Permalink
Browse files

Remove keep-alive in web server due to thread leaks.

  • Loading branch information...
birchb1024 committed Apr 7, 2019
1 parent c2370bc commit 3fcdb071ccb6826dd40563d7707d0e85ce076350
Showing with 6 additions and 19 deletions.
  1. +6 −19 src/org/genyris/web/NanoHTTPD.java
@@ -303,31 +303,18 @@ public HTTPSession(Socket socket) {

public void run() {
try {
while(keepAlive) {
if(is.available() > 0) {
handleRequest();
} else {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
}
}
try {
mySocket.close();
} catch (IOException ignore) { }

handleRequest();
} catch (NanoException e) {
try {
mySocket.close();
} catch (IOException ignore) { }
System.out.println(e.getMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
mySocket.close();
} catch (IOException ignore) { }

}
}

public void handleRequest() throws NanoException {
try {

0 comments on commit 3fcdb07

Please sign in to comment.
You can’t perform that action at this time.