vimpunk / cratetorrent

A BitTorrent V1 engine library for Rust (and currently Linux)
468 stars 35 forks source link

Upgrade dependencies #104

Closed pawanjay176 closed 2 years ago

pawanjay176 commented 3 years ago

Fixes #76 Fixes #101

Upgrade all dependencies (except bitvec).

some not straightforward updates:

  1. No need to use fused futures with UnboundedReceiver .
  2. length reading code in codec.rs changed to use some extra apis provided in bytes 1.0 (tests work, but not sure if code can be improved further).
vimpunk commented 3 years ago

What was the issue with bitvec, by the way?

pawanjay176 commented 3 years ago

@mandreyel Sorry for fixing the review comments so late.

got the following warnings

These warnings are present in the master branch as well, so I didn't touch those. Can fix those up in this PR if you want though :)

What was the issue with bitvec, by the way?

The bitvec changes were a little more involved as the upstream api had changed. I felt it would be better to have only tokio changes in this PR.

vimpunk commented 3 years ago

Thanks for addressing the comments!

These warnings are present in the master branch as well, so I didn't touch those. Can fix those up in this PR if you want though :)

You're right, my bad. They are out of scope for this PR, I am fixing them separately. Thanks though.

The bitvec changes were a little more involved as the upstream api had changed. I felt it would be better to have only tokio changes in this PR.

Fair enough, @jbrady42 has submitted a patch separately that I will apply on top of yours once done.


There is one more thing before we can merge. The binary used for the integration tests seems not to have been updated for latest tokio, based on this error:

error[E0599]: the method `next` exists for struct `tokio::sync::mpsc::unbounded::UnboundedReceiver<cratetorrent::alert::Alert>`, but its trait bounds were not satisfied
  --> src/main.rs:72:38
   |
72 |     while let Some(alert) = alert_rx.next().await {
   |                                      ^^^^ method cannot be called on `tokio::sync::mpsc::unbounded::UnboundedReceiver<cratetorrent::alert::Alert>` due to unsatisfied trait bounds
   | 

If you don't have time we can merge and I'll send a fixup PR, but if you could fix this that would be fantastic.

Thanks for your work.

carbotaniuman commented 2 years ago

Any chance at getting this and #105 merged? I'm looking to make some updates and PRs to this crate, but I don't want to retread past work.

vimpunk commented 2 years ago

@carbotaniuman Yes, sorry, I was dealing with personal issues. I'm merging these MRs and sending a fixup to finish this work. Thanks @pawanjay176 & @jbrady42.