io: BufferedReader.free()
parent
667a26335f
commit
852d302b87
|
@ -55,6 +55,12 @@ pub fn (mut r BufferedReader) read(mut buf []byte) ?int {
|
|||
return read
|
||||
}
|
||||
|
||||
pub fn (mut r BufferedReader) free() {
|
||||
unsafe {
|
||||
r.buf.free()
|
||||
}
|
||||
}
|
||||
|
||||
// fill_buffer attempts to refill the internal buffer
|
||||
// and returns whether it got any data
|
||||
fn (mut r BufferedReader) fill_buffer() bool {
|
||||
|
|
|
@ -305,6 +305,9 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
|
|||
conn.close() or {}
|
||||
}
|
||||
mut reader := io.new_buffered_reader(reader: io.make_reader(conn))
|
||||
defer {
|
||||
reader.free()
|
||||
}
|
||||
page_gen_start := time.ticks()
|
||||
req := parse_request(mut reader) or {
|
||||
eprintln('error parsing request: $err')
|
||||
|
|
Loading…
Reference in New Issue