Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: call update_connection_history for proxified connections #6075

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/imap/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl Client {
Client::connect_insecure_proxy(context, host, port, proxy_config).await?
}
};
update_connection_history(context, "imap", host, port, host, time()).await?;
Ok(client)
} else {
let load_cache = match security {
Expand Down
8 changes: 8 additions & 0 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ pub(crate) async fn prune_connection_history(context: &Context) -> Result<()> {
Ok(())
}

/// Update the timestamp of the last successfull connection
/// to the given `host` and `port`
/// with the given application protocol `alpn`.
///
/// `addr` is the string representation of IP address.
/// If connection is made over a proxy which does
/// its own DNS resolution,
/// `addr` should be the same as `host`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe still better an empty string? That would be shorter codewise. Why does this matter at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not really matter, just has to be consistent so we don't get multiple entries, some for "", some for the host, some for "proxy" etc.

pub(crate) async fn update_connection_history(
context: &Context,
alpn: &str,
Expand Down
1 change: 1 addition & 0 deletions src/smtp/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ async fn connect_stream(
connect_insecure_proxy(context, host, port, proxy_config.clone()).await?
}
};
update_connection_history(context, "smtp", host, port, host, time()).await?;
Ok(stream)
} else {
let load_cache = match security {
Expand Down
Loading