Merge pull request #22 from greatest-ape/fixes

Bug fixes, minor improments, README update
This commit is contained in:
Joakim Frostegård 2021-11-05 13:52:50 +01:00 committed by GitHub
commit fec7236763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 13 deletions

View file

@ -186,6 +186,10 @@ clients, with some exceptions:
* Doesn't track of the number of torrent downloads (0 is always sent). * Doesn't track of the number of torrent downloads (0 is always sent).
* Doesn't allow full scrapes, i.e. of all registered info hashes * Doesn't allow full scrapes, i.e. of all registered info hashes
The current glommio-based implementation currently has large performance
regressions compared to [the previous mio-based implementation](https://github.com/greatest-ape/aquatic/tree/30fa96a7f43eb7568b7df1e1fdb6e1885f3b4f58).
Use it instead if you want maximum performance now.
#### TLS #### TLS
Please see `aquatic_http` TLS section above. Please see `aquatic_http` TLS section above.

View file

@ -105,8 +105,8 @@ async fn handle_request_stream<S>(
::log::debug!("preparing to send response to channel: {:?}", response); ::log::debug!("preparing to send response to channel: {:?}", response);
if let Err(err) = response_senders.try_send_to(producer_index, (response, src)) { if let Err(err) = response_senders.send_to(producer_index, (response, src)).await {
::log::warn!("response_sender.try_send: {:?}", err); ::log::error!("response_sender.send: {:?}", err);
} }
yield_if_needed().await; yield_if_needed().await;

View file

@ -240,15 +240,15 @@ async fn read_requests(
let request_consumer_index = let request_consumer_index =
calculate_request_consumer_index(&config, request.info_hash); calculate_request_consumer_index(&config, request.info_hash);
if let Err(err) = request_senders.try_send_to( if let Err(err) = request_senders.send_to(
request_consumer_index, request_consumer_index,
( (
response_consumer_index, response_consumer_index,
ConnectedRequest::Announce(request), ConnectedRequest::Announce(request),
src, src,
), ),
) { ).await {
::log::warn!("request_sender.try_send failed: {:?}", err) ::log::error!("request_sender.try_send failed: {:?}", err)
} }
} else { } else {
let response = Response::Error(ErrorResponse { let response = Response::Error(ErrorResponse {
@ -300,11 +300,11 @@ async fn read_requests(
original_indices, original_indices,
}; };
if let Err(err) = request_senders.try_send_to( if let Err(err) = request_senders.send_to(
consumer_index, consumer_index,
(response_consumer_index, request, src), (response_consumer_index, request, src),
) { ).await {
::log::warn!("request_sender.try_send failed: {:?}", err) ::log::error!("request_sender.send failed: {:?}", err)
} }
} }
} }

View file

@ -378,11 +378,9 @@ struct ConnectionWriter {
impl ConnectionWriter { impl ConnectionWriter {
async fn run_out_message_loop(&mut self) -> anyhow::Result<()> { async fn run_out_message_loop(&mut self) -> anyhow::Result<()> {
loop { loop {
let (meta, out_message) = self let (meta, out_message) = self.out_message_receiver.recv().await.ok_or_else(|| {
.out_message_receiver anyhow::anyhow!("ConnectionWriter couldn't receive message, sender is closed")
.recv() })?;
.await
.expect("wait_for_out_message: can't receive out_message, sender is closed");
if meta.naive_peer_addr != self.peer_addr { if meta.naive_peer_addr != self.peer_addr {
return Err(anyhow::anyhow!("peer addresses didn't match")); return Err(anyhow::anyhow!("peer addresses didn't match"));