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

use golang.org/x/sys/unix instead of syscall #2927

Merged
merged 1 commit into from
Dec 6, 2020
Merged

Conversation

marten-seemann
Copy link
Member

As suggested by @mvdan in #2896 (review). An excellent suggestion, as it allows us to get rid of two OS-specific files.

conn_ecn.go Outdated
@@ -29,7 +31,7 @@ func inspectReadBuffer(c net.PacketConn) (int, error) {
var size int
var serr error
if err := rawConn.Control(func(fd uintptr) {
size, serr = syscall.GetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
size, serr = unix.GetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF)

Choose a reason for hiding this comment

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

These constants exist in the unix package also, for consistency.

Suggested change
size, serr = unix.GetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
size, serr = unix.GetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RCVBUF)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, missed that one!

@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #2927 (f59cd92) into master (5a0ce24) will increase coverage by 0.37%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2927      +/-   ##
==========================================
+ Coverage   86.24%   86.61%   +0.37%     
==========================================
  Files         133      132       -1     
  Lines        9143     9378     +235     
==========================================
+ Hits         7885     8122     +237     
+ Misses        910      907       -3     
- Partials      348      349       +1     
Impacted Files Coverage Δ
conn_ecn.go 70.97% <100.00%> (ø)
conn_windows.go 60.00% <100.00%> (ø)
qlog/frame.go 98.47% <0.00%> (+0.20%) ⬆️
qlog/event.go 98.23% <0.00%> (+0.57%) ⬆️
qlog/qlog.go 96.96% <0.00%> (+1.29%) ⬆️
qlog/packet_header.go 98.46% <0.00%> (+3.72%) ⬆️
qlog/trace.go 96.77% <0.00%> (+5.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a0ce24...f59cd92. Read the comment docs.

@marten-seemann marten-seemann force-pushed the avoid-syscall branch 2 times, most recently from 48bc453 to 6eca82a Compare December 6, 2020 03:10
@marten-seemann
Copy link
Member Author

Looks like I was too optimistic here.
On Linux, the Type of the TOS control message is unix.IP_TOS, whereas on Darwin it's unix.IP_RECVTOS 🤦🏻‍♂️:
https://github.com/lucas-clemente/quic-go/blob/5a0ce242654c153128ca8679e8fe19fc3be966d3/conn_ecn.go#L96-L105

That means we'll still need OS-specific files to set the msgTypeIPTOS constant.

@marten-seemann marten-seemann merged commit 325bc16 into master Dec 6, 2020
@marten-seemann marten-seemann deleted the avoid-syscall branch December 6, 2020 05:19
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
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.

3 participants