From 2ed4457c5f68b96d044045c6930f4f7288134383 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 10 Jun 2020 11:23:41 +0200 Subject: [PATCH] vweb: init_once() --- vlib/vweb/vweb.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 81571879ca..76b2569641 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -131,13 +131,13 @@ pub fn (ctx &Context) get_header(key string) string { pub fn run(port int) { mut app := T{} run_app(mut app, port) -} +} pub fn run_app(mut app T, port int) { println('Running a Vweb app on http://localhost:$port ...') l := net.listen(port) or { panic('failed to listen') } app.vweb = Context{} - app.init() + app.init_once() //app.reset() for { conn := l.accept() or { panic('accept() failed') } @@ -285,6 +285,7 @@ fn handle_conn(conn net.Socket, mut app T) { //$if debug { println('action=$action') //} + app.init() app.$action() /* app.$action() or { @@ -292,7 +293,7 @@ fn handle_conn(conn net.Socket, mut app T) { } */ conn.close() or {} - app.reset() + //app.reset() return }