Timeout adjustments, random serial number
This commit is contained in:
parent
e44cbc1e26
commit
18f7989e28
2 changed files with 13 additions and 5 deletions
|
|
@ -202,8 +202,16 @@ impl LyingCertificateRegistry {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
cert_builder.set_not_before(cert.not_before()).unwrap();
|
cert_builder.set_not_before(cert.not_before()).unwrap();
|
||||||
|
let mut serial = openssl::bn::BigNum::new().unwrap();
|
||||||
|
serial
|
||||||
|
.rand(160, openssl::bn::MsbOption::MAYBE_ZERO, false)
|
||||||
|
.unwrap();
|
||||||
cert_builder
|
cert_builder
|
||||||
.set_serial_number(cert.serial_number())
|
.set_serial_number(
|
||||||
|
openssl::asn1::Asn1Integer::from_bn(&serial.as_ref())
|
||||||
|
.unwrap()
|
||||||
|
.as_ref(),
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
cert_builder.set_subject_name(cert.subject_name()).unwrap();
|
cert_builder.set_subject_name(cert.subject_name()).unwrap();
|
||||||
cert_builder.set_version(cert.version()).unwrap();
|
cert_builder.set_version(cert.version()).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ pub async fn play(
|
||||||
//let mut previous = Vec::new();
|
//let mut previous = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
let req = match tokio::time::timeout(
|
let req = match tokio::time::timeout(
|
||||||
tokio::time::Duration::from_secs(5),
|
tokio::time::Duration::from_secs(10),
|
||||||
stream.next(),
|
stream.next(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
@ -274,7 +274,7 @@ pub async fn play(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stream.get_mut().shutdown().await.unwrap();
|
stream.get_mut().shutdown().await.ok();
|
||||||
};
|
};
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
fut.await;
|
fut.await;
|
||||||
|
|
@ -297,7 +297,7 @@ pub async fn play(
|
||||||
//let mut previous = Vec::new();
|
//let mut previous = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
let Ok(req) =
|
let Ok(req) =
|
||||||
tokio::time::timeout(tokio::time::Duration::from_secs(5), stream.next())
|
tokio::time::timeout(tokio::time::Duration::from_secs(10), stream.next())
|
||||||
.await
|
.await
|
||||||
else {
|
else {
|
||||||
if break_next {
|
if break_next {
|
||||||
|
|
@ -346,7 +346,7 @@ pub async fn play(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//println!("Server shutdown");
|
//println!("Server shutdown");
|
||||||
stream.get_mut().shutdown().await.unwrap();
|
stream.get_mut().shutdown().await.ok();
|
||||||
};
|
};
|
||||||
// Using a variable for the future allows it to be detected by tokio-console
|
// Using a variable for the future allows it to be detected by tokio-console
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue