mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb,net: fix vweb crash when the connection was closed prematurely (tested with Chrome on windows, refreshing as fast as possible)
This commit is contained in:
@ -717,10 +717,16 @@ pub fn not_found() Result {
|
||||
}
|
||||
|
||||
fn send_string(mut conn net.TcpConn, s string) ! {
|
||||
$if trace_send_string_conn ? {
|
||||
eprintln('> send_string: conn: ${ptr_str(conn)}')
|
||||
}
|
||||
$if trace_response ? {
|
||||
eprintln('> send_string:\n${s}\n')
|
||||
}
|
||||
conn.write(s.bytes())!
|
||||
if voidptr(conn) == unsafe { nil } {
|
||||
return error('connection was closed before send_string')
|
||||
}
|
||||
conn.write_string(s)!
|
||||
}
|
||||
|
||||
// Do not delete.
|
||||
|
Reference in New Issue
Block a user