Skip to content

fix: add TLS session resumption#1304

Open
mavonx wants to merge 1 commit into
floatpane:masterfrom
mavonx:fix/issue-1174
Open

fix: add TLS session resumption#1304
mavonx wants to merge 1 commit into
floatpane:masterfrom
mavonx:fix/issue-1174

Conversation

@mavonx
Copy link
Copy Markdown
Contributor

@mavonx mavonx commented May 17, 2026

What?

Configured TLS session resumption for IMAP and SMTP.

Why?

Reduce reconnect latency by avoiding full TLS handshakes.

Closes #1174

@mavonx mavonx requested a review from a team as a code owner May 17, 2026 22:15
@floatpanebot floatpanebot added bug Something isn't working area/fetcher IMAP fetch / IDLE / search area/sender SMTP send path area/config Configuration / settings size/S Diff: 11–50 lines and removed bug Something isn't working labels May 17, 2026
@andrinoff andrinoff added the bug Something isn't working label May 18, 2026
@andrinoff andrinoff requested a review from FromSi May 18, 2026 09:04
Comment thread fetcher/fetcher.go
MinVersion: tls.VersionTLS12,
ClientSessionCache: account.ClientSessionCache,
VerifyConnection: func(cs tls.ConnectionState) error {
log.Printf("SMTP connection resumed: %t", cs.DidResume)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

log.Printf("IMAP TLS session resumed: %t", cs.DidResume)

Comment thread config/config.go
if a.ClientSessionCache == nil {
a.ClientSessionCache = tls.NewLRUClientSessionCache(64)
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the same account is used concurrently, for example by a background IMAP reconnect and an SMTP send, this can cause a data race during the first cache initialization. It would be better to initialize the cache up front when loading/creating the account, or protect it with a mutex / sync.Once.

@FromSi
Copy link
Copy Markdown
Member

FromSi commented May 18, 2026

@andrinoff Need to verify the expected behavior:

Verify session resumption is happening with a debug log.

I'm not entirely sure if this is implemented correctly or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Configuration / settings area/fetcher IMAP fetch / IDLE / search area/sender SMTP send path bug Something isn't working size/S Diff: 11–50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: TLS sessions are not resumed across reconnects

4 participants