rpc: JSON-RPC-over-HTTP control interface — native httpd + json + dispatch, core provider

This commit is contained in:
Jean Chevronnet 2026-08-09 15:54:05 +00:00
parent 9dce3bde92
commit 4b1f096ed8
7 changed files with 617 additions and 0 deletions

View file

@ -52,6 +52,15 @@ pub enum Event {
status: u16,
body: String,
},
/// An inbound JSON-RPC request from the HTTP control interface (see
/// `crate::modules::rpc`). Handled inline on the core thread; the reply JSON is
/// sent back to the waiting httpd thread over `reply`.
RpcRequest {
method: String,
params: String,
id: String,
reply: std::sync::mpsc::Sender<String>,
},
/// Background timer tick — drives ping/idle timeouts.
Tick,
}
@ -156,6 +165,16 @@ impl Ircd {
);
}
}
Event::RpcRequest {
method,
params,
id,
reply,
} => {
let resp =
crate::modules::rpc::dispatch(&mut self.server, &method, &params, &id);
let _ = reply.send(resp);
}
Event::Tick => self.on_tick(),
}
self.drain_hooks();