multi host client demo

Bind to the same interface as the user supplied client address.
This commit is contained in:
Anatoly Yakovenko
2018-05-02 20:38:07 -07:00
parent 48d94143e7
commit b65f04d500
2 changed files with 12 additions and 7 deletions

View File

@ -41,6 +41,7 @@ impl AccountantStub {
let subscriptions = vec![Subscription::EntryInfo];
let req = Request::Subscribe { subscriptions };
let data = serialize(&req).expect("serialize Subscribe");
trace!("subscribing to {}", self.addr);
let _res = self.socket.send_to(&data, &self.addr);
}
@ -114,6 +115,7 @@ impl AccountantStub {
pub fn get_last_id(&mut self) -> FutureResult<Hash, ()> {
let req = Request::GetLastId;
let data = serialize(&req).expect("serialize GetId");
assert!(data.len() < 4096);
self.socket
.send_to(&data, &self.addr)
.expect("buffer error");