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

electrumx: fix removing conn from pool #215

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Conversation

joshuasing
Copy link
Contributor

Summary
Set p.pool to return value of slices.DeleteFunc when removing a connection.
As of go1.23, go vet reports this issue: https://go-review.googlesource.com/c/tools/+/554317

The item is still removed from the slice, however the length of the slice is not updated. See implementation of slices.DeleteFunc:

	clear(s[i:]) // zero/nil out the obsolete elements, for GC
	return s[:i]

This has likely been causing errors with the pool, such as connections not being returned and instead being closed, as well as the size being returned wrong.

Changes

  • Set p.pool to return value of slices.DeleteFunc when removing a connection.

@joshuasing joshuasing added type: refactor This refactors existing functionality type: bug This is a bug size: XS This change is very small (+/- <10) labels Aug 20, 2024
@joshuasing joshuasing merged commit 217419f into main Aug 21, 2024
6 checks passed
@joshuasing joshuasing deleted the joshua/electrumx-del-conn branch August 21, 2024 14:52
web3cryptoguy pushed a commit to web3cryptoguy/heminetwork that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: XS This change is very small (+/- <10) type: bug This is a bug type: refactor This refactors existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants