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

These two bits of code in the path_manager.go file confuse me. #45

Open
linyuana opened this issue Apr 19, 2023 · 0 comments
Open

These two bits of code in the path_manager.go file confuse me. #45

linyuana opened this issue Apr 19, 2023 · 0 comments

Comments

@linyuana
Copy link

1.from ‘setup()’

` // Initial PathID is 0
// PathIDs of client-initiated paths are even
// those of server-initiated paths odd

if pm.sess.perspective == protocol.PerspectiveClient {
	pm.nxtPathID = 1
} else {
	pm.nxtPathID = 2
}

`
2.from ‘createPathFromRemote(p *receivedPacket)’

` // Sanity check: odd is client initiated, even for server initiated

if pm.sess.perspective == protocol.PerspectiveClient && pathID%2 != 0 {
	return nil, errors.New("server tries to create odd pathID")
}
if pm.sess.perspective == protocol.PerspectiveServer && pathID%2 == 0 {
	return nil, errors.New("client tries to create even pathID")
}

`
So who created the odd numbered paths and who created the even numbered paths?

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

No branches or pull requests

1 participant