Skip to content

Commit

Permalink
handle_value return result instead of sending
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Sep 16, 2024
1 parent 192ba8d commit 99f5a8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/electrum/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ impl Connection {
match msg {
Message::Request(line) => {
let cmd: Value = from_str(&line).chain_err(|| "invalid JSON format")?;
self.handle_value(cmd, &empty_params, start_time)?;
let reply = self.handle_value(cmd, &empty_params, start_time)?;
self.send_values(&[reply])?
}
Message::PeriodicUpdate => {
let values = self
Expand All @@ -564,7 +565,7 @@ impl Connection {
cmd: Value,
empty_params: &Value,
start_time: Instant,
) -> Result<()> {
) -> Result<Value> {
Ok(
match (
cmd.get("method"),
Expand Down Expand Up @@ -599,7 +600,7 @@ impl Connection {
})
);

self.send_values(&[reply])?
reply
}
_ => {
bail!("invalid command: {}", cmd)
Expand Down

0 comments on commit 99f5a8b

Please sign in to comment.