Skip to content

Commit

Permalink
fix: ensure data is flushed to disk
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jan 18, 2023
1 parent ba59337 commit 9f9292d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
68 changes: 68 additions & 0 deletions a15b5285230f5a69e14afc94fab00629de02295d383fe6167c596b041c8e1272
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<h1 align="center">sendme</h1>
<div align="center">
<strong>
Send data over the internet.
</strong>
</div>

<br />

<div align="center">
<!-- Crates version -->
<a href="https://crates.io/crates/sendme">
<img src="https://img.shields.io/crates/v/sendme.svg?style=flat-square"
alt="Crates.io version" />
</a>
<!-- Downloads -->
<a href="https://crates.io/crates/sendme">
<img src="https://img.shields.io/crates/d/sendme.svg?style=flat-square"
alt="Download" />
</a>
<!-- docs.rs docs -->
<a href="https://docs.rs/sendme">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
alt="docs.rs docs" />
</a>
</div>

<div align="center">
<h3>
<a href="https://docs.rs/sendme">
API Docs
</a>
<span> | </span>
<a href="/~https://github.com/n0-computer/sendme/releases">
Releases
</a>
</h3>
</div>
<br/>

## Usage

Sending data
```sh
$ ./senmde server <file>
```

Receiving data
```sh
$ ./sendme client <hash>
```

# License

This project is licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this project by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{net::SocketAddr, path::PathBuf};

use anyhow::Result;
use clap::{Parser, Subcommand};
use tokio::io::AsyncWriteExt;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};

use sendme::{client, server};
Expand Down Expand Up @@ -64,6 +65,7 @@ async fn main() -> Result<()> {
let mut wrapped_out = pb.wrap_async_write(out);

let stats = client::run(hash, opts, &mut wrapped_out).await?;
wrapped_out.flush().await?;

pb.finish_with_message(format!(
"Data size: {}MiB\nTime Elapsed: {:.4}s\n{:.2}MBit/s",
Expand Down

0 comments on commit 9f9292d

Please sign in to comment.