vweb: init_once()

pull/5095/head
Alexander Medvednikov 2020-06-10 11:23:41 +02:00
parent 2dc547a45c
commit 2ed4457c5f
1 changed files with 4 additions and 3 deletions

View File

@ -137,7 +137,7 @@ pub fn run_app<T>(mut app T, port int) {
println('Running a Vweb app on http://localhost:$port ...') println('Running a Vweb app on http://localhost:$port ...')
l := net.listen(port) or { panic('failed to listen') } l := net.listen(port) or { panic('failed to listen') }
app.vweb = Context{} app.vweb = Context{}
app.init() app.init_once()
//app.reset() //app.reset()
for { for {
conn := l.accept() or { panic('accept() failed') } conn := l.accept() or { panic('accept() failed') }
@ -285,6 +285,7 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
//$if debug { //$if debug {
println('action=$action') println('action=$action')
//} //}
app.init()
app.$action() app.$action()
/* /*
app.$action() or { app.$action() or {
@ -292,7 +293,7 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
} }
*/ */
conn.close() or {} conn.close() or {}
app.reset() //app.reset()
return return
} }