-
Notifications
You must be signed in to change notification settings - Fork 44
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
pan: expose scmpHandler #266
base: master
Are you sure you want to change the base?
Conversation
|
Add comment for scmpHandler? |
Add comment that scmpHandler=nil behavior? |
Is this method part of the public API? Should there be a second method, without the scmpParam, for backward compatibility? |
Same as for other functions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 LGTMs obtained
pkg/pan/quic_dial.go
line 63 at r1 (raw file):
Previously, tzaeschke (Tilmann) wrote…
Same as for other functions:
- Document
scmpHandler
behavior (nil is recommended for clients)?- Provide second implementation of the function with old signature? This would provide backward compatibility.
dito
pkg/pan/udp_dial.go
line 50 at r1 (raw file):
Previously, tzaeschke (Tilmann) wrote…
Is this method part of the public API? Should there be a second method, without the scmpParam, for backward compatibility?
It is. In Golang we don't have function overload and it is necessary to have different scmpHandling behaviour depending on the application. Whay I can do is change to a "functional options" pattern, to avoid changing the API again in the future. In any case, the signature has to change in any case.
Previously, JordiSubira wrote…
Not sure what the best solution is, just wanted to point it out. Pleas do what you think is best. |
Previously, JordiSubira wrote…
See |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 21 of 24 files at r1.
Reviewable status: complete! 1 of 1 LGTMs obtained
Currently both
ListenUDP
andDialUDP
create always a defaultscmpHandler
this is not desirable for some applications, especially some servers, that may shut down if they receive an unexpected error, e.g., a SCMPError. We expose now to the applications thescmpHandler
a new parameter, if nil is providede the application will internally use the defaultScmpHandler, otherwise it will use the one the applications chooses, e.g., an handler that ignores SCMP packets.This change is