aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-12-05 23:49:35 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-12-05 23:50:55 -0800
commit59f222a0a29f769c746740301db98adc9b6e83ea (patch)
tree7ea3221df3cd5e1e03d2774a6ba29ed87b2edd35 /src
parent66b1ee42a5318c09b005f253dfddef371e6955f4 (diff)
downloadgeniza-59f222a0a29f769c746740301db98adc9b6e83ea.tar.gz
geniza-59f222a0a29f769c746740301db98adc9b6e83ea.zip
count as an arg for recieve-some
Diffstat (limited to 'src')
-rw-r--r--src/bin/geniza-net.rs9
-rw-r--r--src/protocol.rs2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/geniza-net.rs b/src/bin/geniza-net.rs
index 11bcee8..6d38eae 100644
--- a/src/bin/geniza-net.rs
+++ b/src/bin/geniza-net.rs
@@ -43,7 +43,8 @@ fn run() -> Result<()> {
SubCommand::with_name("receive-some")
.about("Connects to a peer, pulls some metadata and content")
.arg_from_usage("<host_port> 'peer host:port to connect to'")
- .arg_from_usage("<dat_key> 'dat key (public key) to register with'"),
+ .arg_from_usage("<dat_key> 'dat key (public key) to register with'")
+ .arg_from_usage("<count> 'how many entries to pull'"),
)
.subcommand(
SubCommand::with_name("discovery-key")
@@ -87,11 +88,11 @@ fn run() -> Result<()> {
("receive-some", Some(subm)) => {
let host_port = subm.value_of("host_port").unwrap();
let dat_key = subm.value_of("dat_key").unwrap();
+ let count: u64 = subm.value_of("count").unwrap().parse().unwrap();
let key_bytes = parse_dat_key(&dat_key)?;
let mut dc = DatConnection::connect(host_port, &key_bytes, false)?;
- // XXX: number here totally arbitrary
- dc.receive_all(false, 10)?;
- dc.receive_all(true, 10)?;
+ dc.receive_some(false, count)?;
+ dc.receive_some(true, count)?;
println!("Done!");
}
("discovery-key", Some(subm)) => {
diff --git a/src/protocol.rs b/src/protocol.rs
index 733477d..2b23959 100644
--- a/src/protocol.rs
+++ b/src/protocol.rs
@@ -449,7 +449,7 @@ impl DatConnection {
}
}
- pub fn receive_all(&mut self, is_content: bool, length: u64) -> Result<()> {
+ pub fn receive_some(&mut self, is_content: bool, length: u64) -> Result<()> {
// Info: downloading, not uploading
let mut im = Info::new();
im.set_uploading(false);