changeset 1351:21b153b4bcc4

better reset_luan for luanhost
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 Mar 2019 12:12:45 -0700
parents d8754a50adf1
children 1604d7f36f3a
files src/luan/host/init.luan src/luan/modules/http/LuanHandler.java
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/host/init.luan	Mon Mar 04 09:41:50 2019 -0700
+++ b/src/luan/host/init.luan	Mon Mar 04 12:12:45 2019 -0700
@@ -79,3 +79,7 @@
 	WebHandler.securityPassword == password or error "wrong password"
 	LuanJava.setSecurity(nil)
 end
+
+function Http.reset_luan()
+	WebHandler.removeHandler(domain)
+end
--- a/src/luan/modules/http/LuanHandler.java	Mon Mar 04 09:41:50 2019 -0700
+++ b/src/luan/modules/http/LuanHandler.java	Mon Mar 04 12:12:45 2019 -0700
@@ -158,17 +158,13 @@
 	}
 
 	public void reset_luan() {
-		new Thread() {
-			public void run() {
-				lock.writeLock().lock();
-				try {
-					close();
-					currentLuan = newLuan();
-				} finally {
-					lock.writeLock().unlock();
-				}
-			}
-		}.start();
+		lock.writeLock().lock();
+		try {
+			close();
+			currentLuan = newLuan();
+		} finally {
+			lock.writeLock().unlock();
+		}
 	}
 
 	public void disable_luan() {