single thread

main
sandyx 11 months ago
parent 780a8a2df2
commit 8d210ebd4d

@ -207,10 +207,11 @@ despace(ROOT)
init_database(db) init_database(db)
TCPServer.open("127.0.0.1", PORT) { |srv| TCPServer.open("127.0.0.1", PORT) { |srv|
mutex = Mutex.new #mutex = Mutex.new
loop do loop do
Thread.start(srv.accept) { |cli| #Thread.start(srv.accept) { |cli|
mutex.synchronize do cli = srv.accept
#mutex.synchronize do
h = Request.new(cli) h = Request.new(cli)
case h.method case h.method
@ -227,8 +228,8 @@ TCPServer.open("127.0.0.1", PORT) { |srv|
end end
cli.close cli.close
end #end
}
end end
} }

Loading…
Cancel
Save