fix: UDM发送MML缓冲1mb延迟300ms

This commit is contained in:
TsMask
2024-01-12 15:42:43 +08:00
parent 65c5378fdb
commit 1e08a6ddeb

View File

@@ -36,11 +36,11 @@ func NewMMLClient(ip string) (*MMLClient, error) {
fmt.Fprintln(conn, passwordMML) fmt.Fprintln(conn, passwordMML)
// 发送后等待 // 发送后等待
awaitTime := time.Duration(500) * time.Millisecond awaitTime := time.Duration(300) * time.Millisecond
time.Sleep(awaitTime) time.Sleep(awaitTime)
// 读取内容 // 读取内容
buf := make([]byte, 20*1024) buf := make([]byte, 1024*1024*1)
n, err := conn.Read(buf) n, err := conn.Read(buf)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -69,7 +69,7 @@ func (c *MMLClient) Send(msg string) error {
// 封装Receive函数用于从TCP连接中接收数据 // 封装Receive函数用于从TCP连接中接收数据
func (c *MMLClient) Receive() (string, error) { func (c *MMLClient) Receive() (string, error) {
buf := make([]byte, 1024*8) buf := make([]byte, 1024*1024*1)
n, err := c.reader.Read(buf) n, err := c.reader.Read(buf)
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {