mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
http_private: make call_announce_procedure cleaner
This commit is contained in:
parent
4d7ea257b8
commit
fc159aa0a0
1 changed files with 5 additions and 8 deletions
|
|
@ -54,12 +54,6 @@ async fn call_announce_procedure(
|
||||||
user_token: String, // FIXME: length
|
user_token: String, // FIXME: length
|
||||||
request: &AnnounceRequest,
|
request: &AnnounceRequest,
|
||||||
) -> anyhow::Result<AnnounceProcedureResults> {
|
) -> anyhow::Result<AnnounceProcedureResults> {
|
||||||
let source_addr = source_addr.get();
|
|
||||||
let source_ip_bytes: Vec<u8> = match source_addr.ip() {
|
|
||||||
IpAddr::V4(ip) => ip.octets().into(),
|
|
||||||
IpAddr::V6(ip) => ip.octets().into(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut t = pool.begin().await?;
|
let mut t = pool.begin().await?;
|
||||||
|
|
||||||
t.execute(
|
t.execute(
|
||||||
|
|
@ -91,8 +85,11 @@ async fn call_announce_procedure(
|
||||||
);
|
);
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.bind(source_ip_bytes)
|
.bind(match source_addr.get().ip() {
|
||||||
.bind(source_addr.port())
|
IpAddr::V4(ip) => Vec::from(ip.octets()),
|
||||||
|
IpAddr::V6(ip) => Vec::from(ip.octets()),
|
||||||
|
})
|
||||||
|
.bind(source_addr.get().port())
|
||||||
.bind(user_agent)
|
.bind(user_agent)
|
||||||
.bind(user_token)
|
.bind(user_token)
|
||||||
.bind(hex::encode(request.info_hash.0))
|
.bind(hex::encode(request.info_hash.0))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue