fix(#6): connect/read timeouts on every HTTP agent
No ureq call had a timeout, so a silent registry hung pull forever. One oci::agent() builder (30 s connect + per-read) now backs registry agents, local ones included, and the kernel downloads.
This commit is contained in:
+3
-2
@@ -34,7 +34,8 @@ pub fn kernel(h: &Path, update: bool, version: Option<String>) -> Result<PathBuf
|
||||
Some(v) => format!("https://api.github.com/repos/{KATA_REPO}/releases/tags/{v}"),
|
||||
None => format!("https://api.github.com/repos/{KATA_REPO}/releases/latest"),
|
||||
};
|
||||
let rel: Value = serde_json::from_reader(ureq::get(&api).call().with_context(|| format!("GET {api}"))?.into_reader())?;
|
||||
let agent = oci::agent().build();
|
||||
let rel: Value = serde_json::from_reader(agent.get(&api).call().with_context(|| format!("GET {api}"))?.into_reader())?;
|
||||
let tag = rel["tag_name"].as_str().ok_or_else(|| anyhow!("no tag in {api}"))?;
|
||||
if k.exists() && installed.as_deref() == Some(tag) {
|
||||
eprintln!("wsbx: kernel already at Kata {tag}");
|
||||
@@ -62,7 +63,7 @@ pub fn kernel(h: &Path, update: bool, version: Option<String>) -> Result<PathBuf
|
||||
.stdin(Stdio::piped())
|
||||
.spawn()?;
|
||||
let mut w = oci::HashWriter(tar.stdin.take().unwrap(), Sha256::new());
|
||||
std::io::copy(&mut ureq::get(url).call()?.into_reader(), &mut w)?;
|
||||
std::io::copy(&mut agent.get(url).call()?.into_reader(), &mut w)?;
|
||||
let oci::HashWriter(stdin, hasher) = w;
|
||||
drop(stdin);
|
||||
if !tar.wait()?.success() {
|
||||
|
||||
Reference in New Issue
Block a user