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

feat: emit an event in EventBus upon dial error #1222

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

adklempner
Copy link
Member

@adklempner adklempner commented Sep 18, 2024

Description

Upon error dialing in PeerConnectionStrategy.dialPeer or WakuNode.connect, emit a DialError event. This allows consumers of go-waku to subscribe to a channel which outputs the dial errors as they occur.

Changes

  • Create DialError interface in utils
  • Add an event emitter for DialError events to PeerConnectionStrategy (created in Start(), closed in Stop())
  • Add a function HandleDialError to PeerConnectionStrategy that:
    • runs existing logic on dial failure (add backoff, add to connection failures in waku peer store)
    • emit a DialError event using the ID of the peer and the returned error message from c.host.Connect(ctx, pi)
  • use above function in PeerConnectionStrategy.dialPeer and WakuNode.connect when an error is returned by host.Connect

Tests

@adklempner adklempner force-pushed the feat/dial-error-event branch 2 times, most recently from 322633b to 35f4f61 Compare September 19, 2024 05:23
@adklempner adklempner marked this pull request as ready for review September 19, 2024 05:23
waku/v2/peermanager/peer_connector.go Outdated Show resolved Hide resolved
waku/v2/peermanager/peer_connector.go Outdated Show resolved Hide resolved
@adklempner adklempner force-pushed the feat/dial-error-event branch 3 times, most recently from d296d47 to 4bba456 Compare September 19, 2024 20:55
waku/v2/node/wakunode2.go Outdated Show resolved Hide resolved
waku/v2/peermanager/peer_connector.go Outdated Show resolved Hide resolved
waku/v2/protocol/lightpush/waku_lightpush_test.go Outdated Show resolved Hide resolved
waku/v2/protocol/peer_exchange/client.go Outdated Show resolved Hide resolved
waku/v2/protocol/store/client.go Outdated Show resolved Hide resolved
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

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

LGTM!

waku/v2/peermanager/peer_manager.go Outdated Show resolved Hide resolved
@adklempner adklempner merged commit 798c9c5 into master Sep 23, 2024
12 checks passed
@adklempner adklempner deleted the feat/dial-error-event branch September 23, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants