feat: add non-blocking NTCP2 sends and Firefox settings sync
- NTCP2: queue outbound data frames and flush them without blocking (send_blocks_nb, send_i2np_nb, flush_nonblocking) - NTCP2: bound write_all with a deadline and set TCP keepalive and user timeout on peer sockets - Firefox extension 0.1.3: save settings as a patch, keep unsaved form fields from being overwritten on refresh, add timeouts to router API calls, and honor the interceptTorrents toggle in the content script
This commit is contained in:
1 parent
82aaa9f11e
commit
9aa15f9ae8
18 files changed
+1323
-239
No files matched your search
@@ -463,10 +463,10 @@ fn send_http_proxy_error(
|
||||
let body = "<!doctype html><html><head><meta charset=\"utf-8\">\{refresh_meta}<title>\{status} \{safe_reason}</title></head><body><h1>\{status} \{safe_reason}</h1><p>\{safe_detail}</p><hr><small>moon-i2p HTTP Proxy</small></body></html>\n"
|
||||
let body_bytes = @encoding.string_to_utf8_bytes(body)
|
||||
let hdr = "HTTP/1.1 \{status} \{reason}\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: \{body_bytes.length()}\r\n\{refresh_hdr}Connection: close\r\n\r\n"
|
||||
let _ = sock.write_all(@encoding.string_to_utf8_bytes(hdr)) catch {
|
||||
let _ = sock.write_all(@encoding.string_to_utf8_bytes(hdr), timeout_ms=500) catch {
|
||||
_ => return
|
||||
}
|
||||
let _ = sock.write_all(body_bytes) catch { _ => () }
|
||||
let _ = sock.write_all(body_bytes, timeout_ms=500) catch { _ => () }
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -475,7 +475,9 @@ fn send_http_proxy_redirect(
|
||||
location : String,
|
||||
) -> Unit {
|
||||
let hdr = "HTTP/1.1 302 Found\r\nLocation: \{location}\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"
|
||||
let _ = sock.write_all(@encoding.string_to_utf8_bytes(hdr)) catch { _ => () }
|
||||
let _ = sock.write_all(@encoding.string_to_utf8_bytes(hdr), timeout_ms=500) catch {
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
|
||||
Reference in new issue
Block a user