fix: 在 OnConnect 把 mochi 发送配额置 0 规避死锁

This commit is contained in:
Nixevol
2026-09-30 16:21:05 +08:00
parent 57c2f70678
commit d94fb25498
4 changed files with 250 additions and 0 deletions
+6
View File
@@ -212,6 +212,11 @@ func connectAndSubscribe(t *testing.T, w net.Conn, endpoint string, maxPacket ui
}
func writeConnect(t *testing.T, w net.Conn, endpoint string, keepalive uint16, maxPacket uint32) {
t.Helper()
writeConnectFull(t, w, endpoint, keepalive, maxPacket, 0)
}
func writeConnectFull(t *testing.T, w net.Conn, endpoint string, keepalive uint16, maxPacket uint32, receiveMax uint16) {
t.Helper()
pk := packets.Packet{
FixedHeader: packets.FixedHeader{Type: packets.Connect},
@@ -228,6 +233,7 @@ func writeConnect(t *testing.T, w net.Conn, endpoint string, keepalive uint16, m
},
Properties: packets.Properties{
MaximumPacketSize: maxPacket,
ReceiveMaximum: receiveMax,
},
}
var buf bytes.Buffer