add dc backpressure to all platforms
This commit is contained in:
1 parent
a96e29c2e5
commit
4ad375bf00
12 files changed
+145
-46
No files matched your search
+11
-1
@@ -22,6 +22,7 @@ func main() {
|
||||
roomFlag := flag.String("room", "", "Blink chat id, blink://<chat id> or group invite link to rejoin (empty = create new room)")
|
||||
resources := flag.String("resources", "default", "resource mode: default, moderate, unlimited, custom")
|
||||
customReadBuf := flag.Int("read-buf", 0, "DC read buffer size in bytes, used with -resources custom")
|
||||
customMaxDCBuf := flag.Int("max-dc-buf", 0, "max DC buffer size in bytes, used with -resources custom")
|
||||
customMemLimit := flag.Int64("mem-limit", 0, "memory limit in bytes, used with -resources custom")
|
||||
writeFile := flag.String("write-file", "", "path to file where the join link is appended")
|
||||
upstreamSocks := flag.String("upstream-socks", "", "route tunneled egress through this SOCKS5 proxy (host:port), e.g. a local VPN client")
|
||||
@@ -36,22 +37,30 @@ func main() {
|
||||
common.AllowLoopbackDst = *allowLoopback
|
||||
|
||||
var readBuf int
|
||||
var maxDCBuf uint64
|
||||
var memLimit int64
|
||||
switch *resources {
|
||||
case "moderate":
|
||||
readBuf = 16384
|
||||
maxDCBuf = 1 << 20
|
||||
memLimit = 64 << 20
|
||||
case "default":
|
||||
readBuf = common.DCBufSize
|
||||
maxDCBuf = common.MaxDCBufSize
|
||||
memLimit = 128 << 20
|
||||
case "unlimited":
|
||||
readBuf = common.RTPBufSize
|
||||
maxDCBuf = 8 << 20
|
||||
memLimit = 256 << 20
|
||||
case "custom":
|
||||
readBuf = *customReadBuf
|
||||
if readBuf == 0 {
|
||||
readBuf = common.RTPBufSize
|
||||
}
|
||||
maxDCBuf = uint64(*customMaxDCBuf)
|
||||
if maxDCBuf == 0 {
|
||||
maxDCBuf = 8 << 20
|
||||
}
|
||||
memLimit = *customMemLimit
|
||||
if memLimit == 0 {
|
||||
memLimit = 256 << 20
|
||||
@@ -62,7 +71,7 @@ func main() {
|
||||
if memLimit > 0 {
|
||||
debug.SetMemoryLimit(memLimit)
|
||||
}
|
||||
log.Printf("[config] resources=%s read-buf=%d mem-limit=%d", *resources, readBuf, memLimit)
|
||||
log.Printf("[config] resources=%s read-buf=%d max-dc-buf=%d mem-limit=%d", *resources, readBuf, maxDCBuf, memLimit)
|
||||
|
||||
if *cookiesPath == "" {
|
||||
log.Fatalf("[auth] --cookies is required")
|
||||
@@ -128,6 +137,7 @@ func main() {
|
||||
Obfuscator: obfuscator,
|
||||
LogFn: log.Printf,
|
||||
ReadBuf: readBuf,
|
||||
MaxDCBuf: maxDCBuf,
|
||||
})
|
||||
session.OnConnected = func(dataTunnel tunnel.DataTunnel) {
|
||||
if activeBridge != nil {
|
||||
|
||||
Reference in new issue
Block a user