连接优化

This commit is contained in:
hahwu 2025-12-30 16:43:07 +08:00
parent 2b5f0e099f
commit d326a8c4cf
3 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ func Init() {
server = new(network.TCPServer)
server.Addr = conf.Server.ListenAddr
server.MaxConnNum = int(math.MaxInt32)
server.PendingWriteNum = conf.PendingWriteNum
server.PendingWriteNum = 1 << 20
server.LenMsgLen = 4
server.MaxMsgLen = 4096
server.NewAgent = newServerAgent

View File

@ -91,7 +91,7 @@ func connectRemote(RemoteAddr string, ConnType int, ConnLabel string) error {
client := new(network.TCPClient)
client.Addr = RemoteAddr
client.ConnNum = 1
client.PendingWriteNum = conf.PendingWriteNum
client.PendingWriteNum = 1 << 20
client.LenMsgLen = 4
client.MaxMsgLen = 4096
client.NewAgent = newAgent

View File

@ -10,8 +10,8 @@ var (
LogFlag = log.LstdFlags | log.Lmicroseconds
// gate conf
PendingWriteNum = 1 << 20 // 1M
MaxMsgLen uint32 = 65536 // 16KB
PendingWriteNum = 65536 // 1M
MaxMsgLen uint32 = 65536 // 16KB
HTTPTimeout = 10 * time.Second
LenMsgLen = 2
LittleEndian = false