fix: UDM发送MML缓冲20k延迟500ms
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user