fix memory leak and add example bare metal installer
This commit is contained in:
@@ -207,7 +207,7 @@ server_start :: proc(server: ^Server) -> bool {
|
||||
// Spawn a new thread for this connection
|
||||
t := thread.create(connection_worker_thread)
|
||||
if t != nil {
|
||||
t.init_context = context
|
||||
//t.init_context = context // We dont actually need need to share the main threads context
|
||||
t.data = conn_data
|
||||
thread.start(t)
|
||||
} else {
|
||||
@@ -272,6 +272,9 @@ handle_connection :: proc(server: ^Server, conn: net.TCP_Socket, source: net.End
|
||||
context.allocator = request_alloc
|
||||
defer context.allocator = old
|
||||
|
||||
// Reset the temp allocator each request
|
||||
defer free_all(context.temp_allocator)
|
||||
|
||||
request, parse_err := parse_request(conn, request_alloc, server.config)
|
||||
|
||||
// Handle parse errors
|
||||
|
||||
Reference in New Issue
Block a user