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

webtransport: check for UDP multiaddr component in address matcher #2491

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

Jorropo
Copy link
Contributor

@Jorropo Jorropo commented Aug 16, 2023

No description provided.

@marten-seemann marten-seemann changed the title fix: check for UDP in the statemachine webtransport address matcher webtransport: check for UDP multiaddr component in address matcher Aug 16, 2023
Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

Haven't reviewed the state machine carefully, but the table test looks rock solid.

@marten-seemann marten-seemann merged commit 457f84a into libp2p:master Aug 16, 2023
11 checks passed
@Jorropo
Copy link
Contributor Author

Jorropo commented Aug 16, 2023

The minimal diff is:

 ma.ForEach(multiaddr, func(c ma.Component) bool {
-		if c.Protocol().Code == ma.P_QUIC_V1 && state == init {
+		if c.Protocol().Code == ma.P_UDP && state == init {
 			state = foundUDP
 		}
 		if c.Protocol().Code == ma.P_QUIC_V1 && state == foundUDP {
 			state = foundQuicV1
 		}
 		if c.Protocol().Code == ma.P_WEBTRANSPORT && state == foundQuicV1 {
 			state = foundWebTransport
 		}
 		if c.Protocol().Code == ma.P_CERTHASH && state == foundWebTransport {
 			certhashCount++
 		}
 		return true
 	})

I thought switch was more readable.

@Jorropo Jorropo deleted the tiny-1 branch August 16, 2023 15:16
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.

2 participants