fix: UDM发送MML缓冲20k延迟500ms

This commit is contained in:
TsMask
2024-01-09 21:25:36 +08:00
parent 0ad45a9b9e
commit ea40fa5351

View File

@@ -36,12 +36,11 @@ func NewMMLClient(ip string) (*MMLClient, error) {
fmt.Fprintln(conn, passwordMML)
// 发送后等待
sleepTime := conf.Get("mml.sleep").(int)
awaitTime := time.Duration(sleepTime) * time.Millisecond
awaitTime := time.Duration(500) * time.Millisecond
time.Sleep(awaitTime)
// 读取内容
buf := make([]byte, 1024*8)
buf := make([]byte, 20*1024)
n, err := conn.Read(buf)
if err != nil {
return nil, err
@@ -78,7 +77,7 @@ func (c *MMLClient) Receive() (string, error) {
}
return "", err
}
c.size += n
return string(buf[0:n]), nil
}