forked from quic-go/quic-go
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sendQueue: ignore "datagram too large" error
This commit introduces additional platform-dependent checking when the kernel returns an error. Previously, the session is terminated when PingFrame sends a discovery packet larger than the limit. With this commit, the error is checked, and if it is "datagram too large", the error is ignored. Additionally, this commit re-enables MTU discovery on Windows unless it is disable explicitly by user. Fixes quic-go#3273 quic-go#3327
- Loading branch information
1 parent
f3b0987
commit 6c6f347
Showing
7 changed files
with
92 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package quic | ||
|
||
import ( | ||
"net" | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func isMsgSizeErr(err error) bool { | ||
if opErr, ok := err.(*net.OpError); ok { | ||
if syscallErr, ok := opErr.Err.(*os.SyscallError); ok { | ||
if syscallErrno, ok := syscallErr.Err.(syscall.Errno); ok { | ||
return assertErrorMsgSize(syscallErrno) | ||
} | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build !unix && !windows | ||
// +build !unix,!windows | ||
|
||
package quic | ||
|
||
import "syscall" | ||
|
||
func assertErrorMsgSize(e syscall.Errno) bool { | ||
// to be implemented for more specific platforms | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build unix | ||
// +build unix | ||
|
||
package quic | ||
|
||
import ( | ||
"errors" | ||
"syscall" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
func assertErrorMsgSize(e syscall.Errno) bool { | ||
// https://man7.org/linux/man-pages/man7/udp.7.html | ||
return errors.Is(e, unix.EMSGSIZE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package quic | ||
|
||
import ( | ||
"errors" | ||
"syscall" | ||
|
||
"golang.org/x/sys/windows" | ||
) | ||
|
||
func assertErrorMsgSize(e syscall.Errno) bool { | ||
// https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/wsaemsgsize-error-10040-in-winsock-2 | ||
return errors.Is(e, windows.WSAEMSGSIZE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters