test: 补齐短时间可测验收并修复建群下行卡住
This commit is contained in:
@@ -34,7 +34,7 @@ func DialMQTTTCP(addr string, timeout time.Duration) (MQTTClient, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = conn.SetDeadline(time.Now().Add(timeout))
|
||||
_ = conn.SetDeadline(time.Time{})
|
||||
return &tcpMQTT{conn: conn, r: bufio.NewReader(conn)}, nil
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ func DialMQTTWebSocket(httpBase string, timeout time.Duration) (MQTTClient, erro
|
||||
_ = raw.Close()
|
||||
return nil, fmt.Errorf("unexpected subprotocol %q", proto)
|
||||
}
|
||||
// 握手完成后清掉超时,否则长会话后续读写会在 dial timeout 到期后全部失败。
|
||||
_ = raw.SetDeadline(time.Time{})
|
||||
return &wsMQTT{conn: raw, r: br}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user