rpc: JSON-RPC-over-HTTP control interface — native httpd + json + dispatch, core provider
This commit is contained in:
parent
9dce3bde92
commit
4b1f096ed8
7 changed files with 617 additions and 0 deletions
19
src/ircd.rs
19
src/ircd.rs
|
|
@ -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, ¶ms, &id);
|
||||
let _ = reply.send(resp);
|
||||
}
|
||||
Event::Tick => self.on_tick(),
|
||||
}
|
||||
self.drain_hooks();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue