From 4091f51bd8f72551906c80f5c7b18d3fa48fecdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 2 Apr 2022 13:55:10 +0200 Subject: [PATCH] http_private: add p_left, make BIGINTs UNSIGNED --- aquatic_http_private/README.md | 5 +++-- aquatic_http_private/src/workers/socket/db.rs | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aquatic_http_private/README.md b/aquatic_http_private/README.md index 57652d0..22aa65c 100644 --- a/aquatic_http_private/README.md +++ b/aquatic_http_private/README.md @@ -22,8 +22,9 @@ CREATE OR REPLACE PROCEDURE aquatic_announce_v1 ( IN p_info_hash CHAR(40), IN p_peer_id CHAR(40), IN p_event VARCHAR(9), - IN p_uploaded BIGINT, - IN p_downloaded BIGINT, + IN p_uploaded BIGINT UNSIGNED, + IN p_downloaded BIGINT UNSIGNED, + IN p_left BIGINT UNSIGNED, OUT p_announce_allowed BOOLEAN, OUT p_failure_reason TEXT, OUT p_warning_message TEXT diff --git a/aquatic_http_private/src/workers/socket/db.rs b/aquatic_http_private/src/workers/socket/db.rs index c507789..74039cb 100644 --- a/aquatic_http_private/src/workers/socket/db.rs +++ b/aquatic_http_private/src/workers/socket/db.rs @@ -14,6 +14,7 @@ pub struct DbAnnounceRequest { event: AnnounceEvent, uploaded: u64, downloaded: u64, + left: u64, } impl DbAnnounceRequest { @@ -33,6 +34,7 @@ impl DbAnnounceRequest { event: request.event, uploaded: request.bytes_uploaded as u64, downloaded: request.bytes_downloaded as u64, + left: request.bytes_left as u64, } } } @@ -71,6 +73,7 @@ pub async fn get_announce_response( ?, ?, ?, + ?, @p_announce_allowed, @p_failure_reason, @p_warning_message @@ -85,7 +88,8 @@ pub async fn get_announce_response( .bind(request.peer_id) .bind(request.event.as_str()) .bind(request.uploaded) - .bind(request.downloaded); + .bind(request.downloaded) + .bind(request.left); t.execute(q).await?;