Skip to content

Commit

Permalink
Consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Nov 12, 2024
1 parent 0ed32b9 commit 1196242
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
22 changes: 11 additions & 11 deletions psst-core/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ impl Transport {
pub fn resolve_ap_with_fallback(proxy_url: Option<&str>) -> Vec<String> {
match Self::resolve_ap(proxy_url) {
Ok(ap_list) => {
log::info!("Successfully resolved {} access points", ap_list.len());
log::info!("successfully resolved {} access points", ap_list.len());
ap_list
}
Err(err) => {
log::error!("Error while resolving APs, using fallback: {:?}", err);
log::error!("error while resolving APs, using fallback: {:?}", err);
vec![AP_FALLBACK.into()]
}
}
Expand All @@ -119,20 +119,20 @@ impl Transport {
}

let agent = default_ureq_agent_builder(proxy_url)?.build();
log::info!("Requesting AP list from {}", AP_RESOLVE_ENDPOINT);
log::info!("requesting AP list from {}", AP_RESOLVE_ENDPOINT);
let data: APResolveData = agent.get(AP_RESOLVE_ENDPOINT).call()?.into_json()?;
if data.ap_list.is_empty() {
log::warn!("Received empty AP list from server");
log::warn!("received empty AP list from server");
Err(Error::UnexpectedResponse)
} else {
log::info!("Received {} APs from server", data.ap_list.len());
log::info!("received {} APs from server", data.ap_list.len());
Ok(data.ap_list)
}
}

pub fn connect(ap_list: &[String], proxy_url: Option<&str>) -> Result<Self, Error> {
log::info!(
"Attempting to connect using {} access points",
"attempting to connect using {} access points",
ap_list.len()
);
for (index, ap) in ap_list.iter().enumerate() {
Expand All @@ -141,26 +141,26 @@ impl Transport {
match Self::stream_through_proxy(ap, url) {
Ok(s) => s,
Err(e) => {
log::warn!("Failed to connect to AP {} through proxy: {:?}", ap, e);
log::warn!("failed to connect to AP {} through proxy: {:?}", ap, e);
continue;
}
}
} else {
match Self::stream_without_proxy(ap) {
Ok(s) => s,
Err(e) => {
log::warn!("Failed to connect to AP {} without proxy: {:?}", ap, e);
log::warn!("failed to connect to AP {} without proxy: {:?}", ap, e);
continue;
}
}
};
if let Err(err) = stream.set_write_timeout(Some(NET_IO_TIMEOUT)) {
log::warn!("Failed to set TCP write timeout: {:?}", err);
log::warn!("failed to set TCP write timeout: {:?}", err);
}
log::info!("Successfully connected to AP: {}", ap);
log::info!("successfully connected to AP: {}", ap);
return Self::exchange_keys(stream);
}
log::error!("Failed to connect to any access point");
log::error!("failed to connect to any access point");
Err(Error::ConnectionFailed)
}

Expand Down
4 changes: 2 additions & 2 deletions psst-core/src/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ pub fn get_authcode_listener(
socket_address: SocketAddr,
timeout: Duration,
) -> Result<AuthorizationCode, String> {
log::info!("Starting OAuth listener on {:?}", socket_address);
log::info!("starting OAuth listener on {:?}", socket_address);
let listener = TcpListener::bind(socket_address)
.map_err(|e| format!("Failed to bind to address: {}", e))?;
log::info!("Listener bound successfully");
log::info!("listener bound successfully");

let (tx, rx) = mpsc::channel();

Expand Down
2 changes: 1 addition & 1 deletion psst-gui/src/controller/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl PlaybackController {
fn send(&mut self, event: PlayerEvent) {
if let Some(s) = &self.sender {
s.send(event)
.map_err(|e| log::error!("Error sending message: {:?}", e))
.map_err(|e| log::error!("error sending message: {:?}", e))
.ok();
}
}
Expand Down
2 changes: 1 addition & 1 deletion psst-gui/src/data/album.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Album {

pub fn release_year_int(&self) -> usize {
self.release_year().parse::<usize>().unwrap_or_else(|err| {
log::error!("Error parsing release year for {}: {}", self.name, err);
log::error!("error parsing release year for {}: {}", self.name, err);
usize::MAX
})
}
Expand Down
4 changes: 1 addition & 3 deletions psst-gui/src/ui/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ impl<W: Widget<AppState>> Controller<AppState, W> for Authenticate {
) {
match event {
Event::Command(cmd) if cmd.is(Self::REQUEST) => {
log::info!("Received Authenticate::REQUEST command");
data.preferences.auth.result.defer_default();

let (auth_url, pkce_verifier) = oauth::generate_auth_url(8888);
Expand Down Expand Up @@ -368,7 +367,7 @@ impl<W: Widget<AppState>> Controller<AppState, W> for Authenticate {
return;
}
Err(e) if retries > 1 => {
log::warn!("Authentication failed, retrying: {:?}", e);
log::warn!("authentication failed, retrying: {:?}", e);
retries -= 1;
}
Err(e) => {
Expand All @@ -391,7 +390,6 @@ impl<W: Widget<AppState>> Controller<AppState, W> for Authenticate {
ctx.set_handled();
}
Event::Command(cmd) if cmd.is(Self::RESPONSE) => {
log::info!("Received Authenticate::RESPONSE command");
self.thread.take();

let result = cmd
Expand Down

0 comments on commit 1196242

Please sign in to comment.