routing work
This commit is contained in:
@@ -3,7 +3,7 @@ use super::*;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RoutedOperation {
|
||||
pub sequencing: Sequencing,
|
||||
pub signatures: Vec<TypedSignature>,
|
||||
pub signatures: Vec<Signature>,
|
||||
pub nonce: Nonce,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
@@ -22,14 +22,14 @@ impl RoutedOperation {
|
||||
reader: &veilid_capnp::routed_operation::Reader,
|
||||
) -> Result<RoutedOperation, RPCError> {
|
||||
let sigs_reader = reader.get_signatures().map_err(RPCError::protocol)?;
|
||||
let mut signatures = Vec::<TypedSignature>::with_capacity(
|
||||
let mut signatures = Vec::<Signature>::with_capacity(
|
||||
sigs_reader
|
||||
.len()
|
||||
.try_into()
|
||||
.map_err(RPCError::map_internal("too many signatures"))?,
|
||||
);
|
||||
for s in sigs_reader.iter() {
|
||||
let sig = decode_typed_signature(&s)?;
|
||||
let sig = decode_signature512(&s)?;
|
||||
signatures.push(sig);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ impl RoutedOperation {
|
||||
);
|
||||
for (i, sig) in self.signatures.iter().enumerate() {
|
||||
let mut sig_builder = sigs_builder.reborrow().get(i as u32);
|
||||
encode_typed_signature(sig, &mut sig_builder);
|
||||
encode_signature512(sig, &mut sig_builder);
|
||||
}
|
||||
let mut n_builder = builder.reborrow().init_nonce();
|
||||
encode_nonce(&self.nonce, &mut n_builder);
|
||||
|
@@ -44,9 +44,6 @@ impl RPCProcessor {
|
||||
&self,
|
||||
msg: RPCMessage,
|
||||
) -> Result<NetworkResult<()>, RPCError> {
|
||||
// Get the crypto kind used to send this question
|
||||
let crypto_kind = msg.header.crypto_kind();
|
||||
|
||||
// Get the question
|
||||
let app_call_q = match msg.operation.kind() {
|
||||
RPCOperationKind::Question(q) => match q.detail() {
|
||||
@@ -56,15 +53,20 @@ impl RPCProcessor {
|
||||
_ => panic!("not a question"),
|
||||
};
|
||||
|
||||
// Get the crypto kind used to send this question
|
||||
let crypto_kind = msg.header.crypto_kind();
|
||||
|
||||
// Get the sender node id this came from
|
||||
let sender = msg
|
||||
.opt_sender_nr
|
||||
.as_ref()
|
||||
.map(|nr| nr.node_ids().get(crypto_kind).unwrap().key);
|
||||
|
||||
// Register a waiter for this app call
|
||||
let id = msg.operation.op_id();
|
||||
let handle = self.unlocked_inner.waiting_app_call_table.add_op_waiter(id);
|
||||
|
||||
// Pass the call up through the update callback
|
||||
let sender = msg
|
||||
.opt_sender_nr
|
||||
.as_ref()
|
||||
.map(|nr| nr.node_ids().get(crypto_kind).unwrap().key);
|
||||
let message = app_call_q.message.clone();
|
||||
(self.unlocked_inner.update_callback)(VeilidUpdate::AppCall(VeilidAppCall {
|
||||
sender,
|
||||
|
Reference in New Issue
Block a user