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

Update tlsClientHandshake #1263

Merged
merged 6 commits into from Apr 9, 2022
Merged

Update tlsClientHandshake #1263

merged 6 commits into from Apr 9, 2022

Conversation

moredure
Copy link
Contributor

@moredure moredure commented Apr 7, 2022

I have such a code in a production crawlers for more than 1 year and it was just fine.
Also we can cleanup peercertificates+verifiedChains slice with nils since they are not used after handshake and in case of many concurrent connections to the same server may occupy some space.

tlsConn.Handshake()
...
state := tlsConn.ConnectionState()
for i := range state.PeerCertificates {
    state.PeerCertificates[i] = nil
}
for i := range state.VerifiedChains { // they contains references to peerCertificates
    state.VerifiedChains[i] = nil
}

in some cases it can free up pretty high amount of in-use space

@moredure moredure force-pushed the patch-1 branch 4 times, most recently from 5b4c39b to e985a73 Compare Apr 7, 2022
client.go Outdated Show resolved Hide resolved
@moredure moredure requested a review from erikdubbelboer Apr 9, 2022
client.go Outdated Show resolved Hide resolved
@moredure moredure requested a review from erikdubbelboer Apr 9, 2022
@erikdubbelboer erikdubbelboer merged commit b40b5a4 into valyala:master Apr 9, 2022
14 checks passed
@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented Apr 9, 2022

Thanks!

@moredure moredure deleted the patch-1 branch Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants