Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixing possible race condition in ethcore_hashContent (#3191)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw authored and arkpar committed Nov 4, 2016
1 parent d27fcec commit e79d9bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rpc/src/v1/impls/ethcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,19 @@ impl<C, M, S: ?Sized, F> Ethcore for EthcoreClient<C, M, S, F> where
.map(Into::into);

// Receive ready and invoke with result.
let ready: Ready<H256> = rx.try_recv().expect("When on_done is invoked ready object is always sent.");
let ready: Ready<H256> = rx.recv().expect(
"recv() fails when `tx` has been dropped, if this closure is invoked `tx` is not dropped (`res == Ok()`); qed"
);
ready.ready(result);
}));

// Either invoke ready right away or transfer it to the closure.
if let Err(e) = res {
ready.ready(Err(errors::from_fetch_error(e)));
} else {
tx.send(ready).expect("Rx end is sent to on_done closure.");
tx.send(ready).expect(
"send() fails when `rx` end is dropped, if `res == Ok()`: `rx` is moved to the closure; qed"
);
}
}
}
Expand Down

0 comments on commit e79d9bf

Please sign in to comment.