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

copy-paste error in NIOTSConnectionChannel getOption0 allowLocalEndpointReuse #133

Open
vvuk opened this issue Oct 7, 2021 · 4 comments

Comments

@vvuk
Copy link

vvuk commented Oct 7, 2021

Looks like a copy-paste mistake here:

case is NIOTSChannelOptions.Types.NIOTSEnablePeerToPeerOption:
self.enablePeerToPeer = value as! NIOTSChannelOptions.Types.NIOTSEnablePeerToPeerOption.Value
case is NIOTSChannelOptions.Types.NIOTSAllowLocalEndpointReuse:
self.allowLocalEndpointReuse = value as! NIOTSChannelOptions.Types.NIOTSEnablePeerToPeerOption.Value

allowLocalEndpointReuse is being set to the value of NIOTSEnablePeerToPeerOption, not itself.

Though it might not really matter, because from everything I can tell allowLocalEndpointReuse seems to be completely broken on NWListener (ref https://developer.apple.com/forums/thread/129452).

@Lukasa
Copy link
Collaborator

Lukasa commented Oct 8, 2021

Good catch! Even if it’s not working well, we’d take a fix to make it correct here.

@AgentFeeble
Copy link
Contributor

It looks like a similar issue slipped through in StateManagedNWConnectionChannel

https://github.com/apple/swift-nio-transport-services/blob/251e9e76134570f0cc5c21e5c6ff3ccb247472ab/Sources/NIOTransportServices/StateManagedNWConnectionChannel.swift#L540C9-L541C113

case is NIOTSChannelOptions.Types.NIOTSAllowLocalEndpointReuse:
    self.allowLocalEndpointReuse = value as! NIOTSChannelOptions.Types.NIOTSEnablePeerToPeerOption.Value

It won't make any difference as long as both NIOTSEnablePeerToPeerOption.Value and NIOTSAllowLocalEndpointReuse.Value are Bools, but it's probably better to fix it anyway for consistency.

@Lukasa
Copy link
Collaborator

Lukasa commented Sep 22, 2023

Agreed. Do you feel like making a patch?

@AgentFeeble
Copy link
Contributor

Sure, I'll submit a PR when I get a chance.

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

3 participants