mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-20 18:23:41 +00:00
proto: use new constructor where possible
This commit is contained in:
committed by
Benjamin Saunders
parent
a1bdfd6113
commit
98e2c26325
@@ -2598,15 +2598,12 @@ impl Connection {
|
||||
|
||||
if self.side.is_client() {
|
||||
// Client-only because server params were set from the client's Initial
|
||||
let params =
|
||||
self.crypto
|
||||
.transport_parameters()?
|
||||
.ok_or_else(|| TransportError {
|
||||
code: TransportErrorCode::crypto(0x6d),
|
||||
frame: None,
|
||||
reason: "transport parameters missing".into(),
|
||||
crypto: None,
|
||||
})?;
|
||||
let params = self.crypto.transport_parameters()?.ok_or_else(|| {
|
||||
TransportError::new(
|
||||
TransportErrorCode::crypto(0x6d),
|
||||
"transport parameters missing".to_owned(),
|
||||
)
|
||||
})?;
|
||||
|
||||
if self.has_0rtt() {
|
||||
if !self.crypto.early_data_accepted().unwrap() {
|
||||
@@ -2674,15 +2671,12 @@ impl Connection {
|
||||
&& starting_space == SpaceId::Initial
|
||||
&& self.highest_space != SpaceId::Initial
|
||||
{
|
||||
let params =
|
||||
self.crypto
|
||||
.transport_parameters()?
|
||||
.ok_or_else(|| TransportError {
|
||||
code: TransportErrorCode::crypto(0x6d),
|
||||
frame: None,
|
||||
reason: "transport parameters missing".into(),
|
||||
crypto: None,
|
||||
})?;
|
||||
let params = self.crypto.transport_parameters()?.ok_or_else(|| {
|
||||
TransportError::new(
|
||||
TransportErrorCode::crypto(0x6d),
|
||||
"transport parameters missing".to_owned(),
|
||||
)
|
||||
})?;
|
||||
self.handle_peer_params(params)?;
|
||||
self.issue_first_cids(now);
|
||||
self.init_0rtt();
|
||||
|
||||
@@ -103,12 +103,7 @@ macro_rules! errors {
|
||||
impl Error {
|
||||
$(
|
||||
pub(crate) fn $name<T>(reason: T) -> Self where T: Into<String> {
|
||||
Self {
|
||||
code: Code::$name,
|
||||
frame: None,
|
||||
reason: reason.into(),
|
||||
crypto: None,
|
||||
}
|
||||
Self::new(Code::$name, reason.into())
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user