Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support windows dev env (#101)
Works in Git Bash and PowerShell in Windows 10
- Loading branch information
Showing
3 changed files
with
48 additions
and
27 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,40 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package rtc | ||
|
||
import ( | ||
"net" | ||
"syscall" | ||
|
||
"github.com/livekit/livekit-server/pkg/logger" | ||
) | ||
|
||
func checkUDPReadBuffer() { | ||
val, err := getUDPReadBuffer() | ||
if err == nil { | ||
if val < minUDPBufferSize { | ||
logger.Warnw("UDP receive buffer is too small for a production set-up", nil, | ||
"current", val, | ||
"suggested", minUDPBufferSize) | ||
} else { | ||
logger.Debugw("UDP receive buffer size", "current", val) | ||
} | ||
} | ||
} | ||
|
||
func getUDPReadBuffer() (int, error) { | ||
conn, err := net.ListenUDP("udp4", nil) | ||
if err != nil { | ||
return 0, err | ||
} | ||
defer func() { _ = conn.Close() }() | ||
_ = conn.SetReadBuffer(defaultUDPBufferSize) | ||
fd, err := conn.File() | ||
if err != nil { | ||
return 0, nil | ||
} | ||
defer func() { _ = fd.Close() }() | ||
|
||
return syscall.GetsockoptInt(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_RCVBUF) | ||
} |
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,7 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package rtc | ||
|
||
func checkUDPReadBuffer() { | ||
} |