Skip to content

Commit

Permalink
Merge pull request #295 from whisperfish/locked-for-hyper
Browse files Browse the repository at this point in the history
Add HTTP 423 LOCKED handling
  • Loading branch information
rubdos committed Mar 13, 2024
2 parents 689a4c2 + c88ab0e commit b0fd817
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions libsignal-service-hyper/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ impl HyperPushService {
})?;
Err(ServiceError::StaleDevices(stale_devices))
},
StatusCode::LOCKED => {
let locked = Self::json(&mut response).await.map_err(|e| {
tracing::error!(
?response,
"Failed to decode HTTP 423 response: {}",
e
);
ServiceError::UnhandledResponseCode {
http_code: StatusCode::LOCKED.as_u16(),
}
})?;
Err(ServiceError::Locked(locked))
},
StatusCode::PRECONDITION_REQUIRED => {
let proof_required =
Self::json(&mut response).await.map_err(|e| {
Expand Down
4 changes: 2 additions & 2 deletions libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ impl RegistrationSessionMetadataResponse {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RegistrationLockFailure {
pub length: u32,
pub time_remaining: u64,
pub length: Option<u32>,
pub time_remaining: Option<u64>,
#[serde(rename = "backup_credentials")]
pub svr1_credentials: Option<AuthCredentials>,
pub svr2_credentials: Option<AuthCredentials>,
Expand Down

0 comments on commit b0fd817

Please sign in to comment.