fix(cmpp): preserve inbound window after message registration

This commit is contained in:
hectorzhao
2026-08-20 12:08:49 +08:00
parent 0757a699ff
commit e9c73333b3
4 changed files with 20 additions and 1 deletions
+15
View File
@@ -346,6 +346,21 @@ func TestBoundedSubmitWindowAndAggregateSlotSnapshot(t *testing.T) {
if configured != 48 || inFlight != 4 {
t.Fatalf("slot snapshot configured=%d in_flight=%d, want 48/4", configured, inFlight)
}
conn := &cmpp.Conn{}
counter := &atomic.Int64{}
counter.Store(2)
rememberDownstream(downstreamSession{
messageID: "MSG-WINDOW-SNAPSHOT", account: "100030", conn: conn,
windowSize: 32, submitInFlight: counter,
})
if got := submitWindowByConn(conn); got != 32 {
t.Fatalf("message registration replaced connection window with %d, want 32", got)
}
configured, inFlight = SubmitSlotSnapshot()
if configured != 80 || inFlight != 6 {
t.Fatalf("post-message slot snapshot configured=%d in_flight=%d, want 80/6", configured, inFlight)
}
}
func TestDecodeInboundLongMessageStripsConcatUDHBeforeUCS2Decode(t *testing.T) {
+2
View File
@@ -169,6 +169,8 @@ func (s Server) handleSubmit(response *cmpp.Response, packet *cmpp.Packet, logge
applicationID: result.ApplicationID,
enterpriseCode: session.enterpriseCode,
protocol: clientProtocol,
windowSize: session.windowSize,
submitInFlight: session.submitInFlight,
srcID: strings.TrimSpace(req.srcID),
phoneNumber: acceptedPhone,
gatewayMsgID: gatewayMsgID,