http_private: add p_left, make BIGINTs UNSIGNED

This commit is contained in:
Joakim Frostegård 2022-04-02 13:55:10 +02:00
parent 82cad25fa8
commit 4091f51bd8
2 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -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?;