summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-02 13:57:28 -0700
committeriximeow <me@iximeow.net>2023-07-02 13:57:28 -0700
commitf36057d23d5de636e2bb1748738772bf031bebdb (patch)
tree59a979f616c6b7143fe790a23d3b6517bddef357 /src
parent1dccbc5b319c9675ef69b34576275d8777375cc8 (diff)
use new protocol bits when ackinga task request
Diffstat (limited to 'src')
-rw-r--r--src/ci_driver.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ci_driver.rs b/src/ci_driver.rs
index 710272d..e3cc4c9 100644
--- a/src/ci_driver.rs
+++ b/src/ci_driver.rs
@@ -432,19 +432,24 @@ async fn handle_next_job(State(ctx): State<(Arc<DbCtx>, mpsc::Sender<RunnerClien
let request = job_resp.next().await.expect("request chunk").expect("chunk exists");
let request = std::str::from_utf8(&request).unwrap();
- let request: WorkRequest = match serde_json::from_str(&request) {
+ let request: ClientProto = match serde_json::from_str(&request) {
Ok(v) => v,
Err(e) => {
eprintln!("couldn't parse work request: {:?}", e);
return (StatusCode::MISDIRECTED_REQUEST, resp_body).into_response();
}
};
- if &request.kind != "new_job_please" {
- eprintln!("bad request kind: {:?}", &request.kind);
- return (StatusCode::MISDIRECTED_REQUEST, resp_body).into_response();
- }
+ let (accepted_pushers, host_info) = match request {
+ ClientProto::NewTaskPlease { allowed_pushers, host_info } => (allowed_pushers, host_info),
+ other => {
+ eprintln!("bad request kind: {:?}", &other);
+ return (StatusCode::MISDIRECTED_REQUEST, resp_body).into_response();
+ }
+ };
+
+ eprintln!("client identifies itself as {:?}", host_info);
- let client = match RunnerClient::new(tx_sender, job_resp, request.accepted_pushers).await {
+ let client = match RunnerClient::new(tx_sender, job_resp, accepted_pushers).await {
Ok(v) => v,
Err(e) => {
eprintln!("unable to register client");