fixing issue #936 - random hangs when starting new server in js mode

This commit is contained in:
fjenett
2012-01-22 12:15:21 +00:00
parent 51a84706da
commit 541449aa2f
2 changed files with 8 additions and 5 deletions
@@ -449,12 +449,13 @@ public class JavaScriptEditor extends Editor
* export to folder, start server, open in default browser.
*/
public void handleStartServer ()
{
{
System.out.println();
statusEmpty();
System.out.println();
if ( !handleExport( false ) ) return;
File serverRoot = getExportFolder();
// if server hung or something else went wrong .. stop it.
if ( jsServer != null &&
(!jsServer.isRunning() || !jsServer.getRoot().equals(serverRoot)) )
@@ -160,7 +160,9 @@ class JavaScriptServer implements HttpConstants, Runnable
{
server.close();
}
} catch ( Exception e ) {;}
} catch ( Exception e ) {
e.printStackTrace();
}
}
public boolean isRunning ()
@@ -203,7 +205,7 @@ class JavaScriptServer implements HttpConstants, Runnable
if ( server != null )
{
inited = true;
while ( thread != null )
{
Socket s = server.accept();