mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
aquatic_udp: don't panic on Response::write error
This commit is contained in:
parent
1f763e63e4
commit
7187190cec
1 changed files with 17 additions and 12 deletions
|
|
@ -292,21 +292,26 @@ fn send_responses(
|
||||||
|
|
||||||
let ip_version = ip_version_from_ip(src.ip());
|
let ip_version = ip_version_from_ip(src.ip());
|
||||||
|
|
||||||
response.write(&mut cursor, ip_version).unwrap();
|
match response.write(&mut cursor, ip_version) {
|
||||||
|
Ok(()) => {
|
||||||
|
let amt = cursor.position() as usize;
|
||||||
|
|
||||||
let amt = cursor.position() as usize;
|
match socket.send_to(&cursor.get_ref()[..amt], src) {
|
||||||
|
Ok(amt) => {
|
||||||
|
responses_sent += 1;
|
||||||
|
bytes_sent += amt;
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
if err.kind() == ErrorKind::WouldBlock {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
match socket.send_to(&cursor.get_ref()[..amt], src) {
|
::log::info!("send_to error: {}", err);
|
||||||
Ok(amt) => {
|
}
|
||||||
responses_sent += 1;
|
|
||||||
bytes_sent += amt;
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
if err.kind() == ErrorKind::WouldBlock {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
::log::info!("send_to error: {}", err);
|
Err(err) => {
|
||||||
|
::log::error!("Response::write error: {:?}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue