.saturating_add(Duration::from_nanos(999_999_999))
.as_secs();
- let time_t = SystemTime::now()
- .duration_since(UNIX_EPOCH)
- .unwrap_or_else(|_| Duration::default()) // clock is being weird
- .as_secs();
+ let time_t = time_t_now();
let time_t = format!("{:x}", time_t);
let hmac = token_hmac(c.ic.secret.0.as_bytes(), time_t.as_bytes());
+ //dbg!(DumpHex(&hmac));
let mut token = time_t;
write!(token, " ").unwrap();
base64::encode_config_buf(&hmac, BASE64_CONFIG, &mut token);
{}
{}
{}
+ {}
{}"#),
&c.ic.link.client,
token,
c.ic.target_requests_outstanding,
show_timeout,
+ c.ic.mtu,
c.ic.max_batch_down,
c.ic.max_batch_up,
);
let status = resp.status();
let mut resp = resp.into_body();
let max_body = c.ic.max_batch_down.sat() + MAX_OVERHEAD;
- let resp = read_limited_bytes(max_body, &mut resp).await
- .context("fetching response body")?;
+ let resp = read_limited_bytes(
+ max_body, default(), default(), &mut resp
+ ).await
+ .discard_data().context("fetching response body")?;
if ! status.is_success() {
throw!(anyhow!("HTTP error status={} body={:?}",
//eprintln!("data={:?}", DumpHex(&data));
match check1(Slip2Mime, ic.mtu, &data, |header| {
- let addr = ip_packet_addr::<false>(header)?;
- if addr != ic.link.client.0 { throw!(PE::Src(addr)) }
+ let saddr = ip_packet_addr::<false>(header)?;
+ if saddr != ic.link.client.0 { throw!(PE::Src(saddr)) }
Ok(())
}) {
- Ok(data) => tx_queue.push_back(TxQueued {
+ Ok((data, ())) => tx_queue.push_back(TxQueued {
data,
expires: Instant::now() + ic.max_queue_time
}),
if let Some(got) = got {
//eprintln!("got={:?}", DumpHex(&got));
- match checkn(SlipNoConv,ic.mtu, &got, &mut rx_queue, |header| {
+ match checkn(SlipNoConv,ic.mtu, &got, |header| {
let addr = ip_packet_addr::<true>(header)?;
if addr != ic.link.client.0 { throw!(PE::Dst(addr)) }
Ok(())
- }, |e| error!("{} #{}: rx discarding: {}", &ic, req_num, e)) {
+ }, |o| Ok({ rx_queue.push(o); }),
+ |e| error!("{} #{}: rx discarding: {}", &ic, req_num, e))
+ {
Ok(()) => reporter.lock().success(),
Err(ErrorOnlyBad) => {
reqs.push(Box::pin(async {
#[tokio::main]
async fn main() {
let opts = Opts::from_args();
- let (ics,()) = config::startup("hippotat", LinkEnd::Client,
- &opts.config, &opts.log, |_|Ok(()));
+ let (ics,) = config::startup("hippotat", LinkEnd::Client,
+ &opts.config, &opts.log, |ics|Ok((ics,)));
let https = HttpsConnector::new();
let hclient = hyper::Client::builder()