mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
aquatic_http: improve ConnectionMeta field names and types
This commit is contained in:
parent
2deadb2fff
commit
af0761418e
3 changed files with 13 additions and 13 deletions
1
TODO.md
1
TODO.md
|
|
@ -1,7 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
* aquatic_http glommio:
|
* aquatic_http glommio:
|
||||||
* get rid of / improve ConnectionMeta stuff in handler
|
|
||||||
* clean out connections regularly
|
* clean out connections regularly
|
||||||
* timeout inside of task for "it took to long to receive request, send response"?
|
* timeout inside of task for "it took to long to receive request, send response"?
|
||||||
* handle panicked/cancelled tasks
|
* handle panicked/cancelled tasks
|
||||||
|
|
|
||||||
|
|
@ -129,15 +129,16 @@ impl Ip for Ipv6Addr {}
|
||||||
pub struct ConnectionMeta {
|
pub struct ConnectionMeta {
|
||||||
/// Index of socket worker responsible for this connection. Required for
|
/// Index of socket worker responsible for this connection. Required for
|
||||||
/// sending back response through correct channel to correct worker.
|
/// sending back response through correct channel to correct worker.
|
||||||
pub worker_index: usize, // Or response consumer id in glommio
|
pub response_consumer_id: ConsumerId,
|
||||||
pub peer_addr: SocketAddr,
|
pub peer_addr: SocketAddr,
|
||||||
pub poll_token: usize, // Or connection id in glommio
|
/// Connection id local to socket worker
|
||||||
|
pub connection_id: ConnectionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct PeerConnectionMeta<I: Ip> {
|
pub struct PeerConnectionMeta<I: Ip> {
|
||||||
pub worker_index: usize,
|
pub response_consumer_id: ConsumerId,
|
||||||
pub poll_token: usize,
|
pub connection_id: ConnectionId,
|
||||||
pub peer_ip_address: I,
|
pub peer_ip_address: I,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ async fn handle_request_stream<S>(
|
||||||
connection_id,
|
connection_id,
|
||||||
} => {
|
} => {
|
||||||
let meta = ConnectionMeta {
|
let meta = ConnectionMeta {
|
||||||
worker_index: response_consumer_id.0,
|
response_consumer_id,
|
||||||
poll_token: connection_id.0,
|
connection_id,
|
||||||
peer_addr,
|
peer_addr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -126,8 +126,8 @@ async fn handle_request_stream<S>(
|
||||||
connection_id,
|
connection_id,
|
||||||
} => {
|
} => {
|
||||||
let meta = ConnectionMeta {
|
let meta = ConnectionMeta {
|
||||||
worker_index: response_consumer_id.0,
|
response_consumer_id,
|
||||||
poll_token: connection_id.0,
|
connection_id,
|
||||||
peer_addr,
|
peer_addr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -172,8 +172,8 @@ pub fn handle_announce_request(
|
||||||
torrent_maps.ipv4.entry(request.info_hash).or_default();
|
torrent_maps.ipv4.entry(request.info_hash).or_default();
|
||||||
|
|
||||||
let peer_connection_meta = PeerConnectionMeta {
|
let peer_connection_meta = PeerConnectionMeta {
|
||||||
worker_index: meta.worker_index,
|
response_consumer_id: meta.response_consumer_id,
|
||||||
poll_token: meta.poll_token,
|
connection_id: meta.connection_id,
|
||||||
peer_ip_address,
|
peer_ip_address,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -201,8 +201,8 @@ pub fn handle_announce_request(
|
||||||
torrent_maps.ipv6.entry(request.info_hash).or_default();
|
torrent_maps.ipv6.entry(request.info_hash).or_default();
|
||||||
|
|
||||||
let peer_connection_meta = PeerConnectionMeta {
|
let peer_connection_meta = PeerConnectionMeta {
|
||||||
worker_index: meta.worker_index,
|
response_consumer_id: meta.response_consumer_id,
|
||||||
poll_token: meta.poll_token,
|
connection_id: meta.connection_id,
|
||||||
peer_ip_address,
|
peer_ip_address,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue