Forráskód Böngészése

foodgroup: send relayed SNACs with the server's request ID

ICBM typing events and client errors relayed to the recipient, and
feedbag start and end cluster markers relayed to the user's other
instances, carry wire.ReqIDFromServer, as the server's other relays do.
Mike 1 hete
szülő
commit
4c114e3915
4 módosított fájl, 30 hozzáadás és 14 törlés
  1. 12 4
      foodgroup/feedbag.go
  2. 12 4
      foodgroup/feedbag_test.go
  3. 2 2
      foodgroup/icbm.go
  4. 4 4
      foodgroup/icbm_test.go

+ 12 - 4
foodgroup/feedbag.go

@@ -538,8 +538,12 @@ func (s *FeedbagService) DeleteItem(ctx context.Context, instance *state.Session
 func (s *FeedbagService) StartCluster(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x13_0x11_FeedbagStartCluster) {
 	instance.BeginNotifyTxn()
 	s.messageRelayer.RelayToOtherInstances(ctx, instance, wire.SNACMessage{
-		Frame: inFrame,
-		Body:  inBody,
+		Frame: wire.SNACFrame{
+			FoodGroup: wire.Feedbag,
+			SubGroup:  wire.FeedbagStartCluster,
+			RequestID: wire.ReqIDFromServer,
+		},
+		Body: inBody,
 	})
 }
 
@@ -548,8 +552,12 @@ func (s *FeedbagService) StartCluster(ctx context.Context, instance *state.Sessi
 // changes accumulated during the transaction.
 func (s *FeedbagService) EndCluster(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame) error {
 	s.messageRelayer.RelayToOtherInstances(ctx, instance, wire.SNACMessage{
-		Frame: inFrame,
-		Body:  wire.SNAC_0x13_0x12_FeedbagEndCluster{},
+		Frame: wire.SNACFrame{
+			FoodGroup: wire.Feedbag,
+			SubGroup:  wire.FeedbagEndCluster,
+			RequestID: wire.ReqIDFromServer,
+		},
+		Body: wire.SNAC_0x13_0x12_FeedbagEndCluster{},
 	})
 
 	shouldNotify, filter := instance.EndNotifyTxn()

+ 12 - 4
foodgroup/feedbag_test.go

@@ -4828,8 +4828,12 @@ func TestFeedbagService_StartCluster(t *testing.T) {
 	messageRelayer := newMockMessageRelayer(t)
 	messageRelayer.EXPECT().
 		RelayToOtherInstances(matchContext(), instance, wire.SNACMessage{
-			Frame: inFrame,
-			Body:  inBody,
+			Frame: wire.SNACFrame{
+				FoodGroup: wire.Feedbag,
+				SubGroup:  wire.FeedbagStartCluster,
+				RequestID: wire.ReqIDFromServer,
+			},
+			Body: inBody,
 		})
 
 	svc := NewFeedbagService(slog.Default(), messageRelayer, nil, nil, nil, nil, nil, nil, newMockBuddyAddedNotifierDeduper(t))
@@ -4845,8 +4849,12 @@ func TestFeedbagService_EndCluster(t *testing.T) {
 		RequestID: 1234,
 	}
 	endRelay := wire.SNACMessage{
-		Frame: endFrame,
-		Body:  wire.SNAC_0x13_0x12_FeedbagEndCluster{},
+		Frame: wire.SNACFrame{
+			FoodGroup: wire.Feedbag,
+			SubGroup:  wire.FeedbagEndCluster,
+			RequestID: wire.ReqIDFromServer,
+		},
+		Body: wire.SNAC_0x13_0x12_FeedbagEndCluster{},
 	}
 
 	cases := []struct {

+ 2 - 2
foodgroup/icbm.go

@@ -530,7 +530,7 @@ func (s *ICBMService) ClientEvent(ctx context.Context, instance *state.SessionIn
 			Frame: wire.SNACFrame{
 				FoodGroup: wire.ICBM,
 				SubGroup:  wire.ICBMClientEvent,
-				RequestID: inFrame.RequestID,
+				RequestID: wire.ReqIDFromServer,
 			},
 			Body: wire.SNAC_0x04_0x14_ICBMClientEvent{
 				Cookie:     inBody.Cookie,
@@ -549,7 +549,7 @@ func (s *ICBMService) ClientErr(ctx context.Context, instance *state.SessionInst
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.ICBM,
 			SubGroup:  wire.ICBMClientErr,
-			RequestID: inFrame.RequestID,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x04_0x0B_ICBMClientErr{
 			Cookie:     inBody.Cookie,

+ 4 - 4
foodgroup/icbm_test.go

@@ -2768,7 +2768,7 @@ func TestICBMService_ClientEvent(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.ICBM,
 									SubGroup:  wire.ICBMClientEvent,
-									RequestID: 1234,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x04_0x14_ICBMClientEvent{
 									Cookie:     12345678,
@@ -2820,7 +2820,7 @@ func TestICBMService_ClientEvent(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.ICBM,
 									SubGroup:  wire.ICBMClientEvent,
-									RequestID: 5678,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x04_0x14_ICBMClientEvent{
 									Cookie:     87654321,
@@ -2872,7 +2872,7 @@ func TestICBMService_ClientEvent(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.ICBM,
 									SubGroup:  wire.ICBMClientEvent,
-									RequestID: 9999,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x04_0x14_ICBMClientEvent{
 									Cookie:     98765432,
@@ -3549,7 +3549,7 @@ func TestICBMService_ClientErr(t *testing.T) {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.ICBM,
 			SubGroup:  wire.ICBMClientErr,
-			RequestID: 1234,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x04_0x0B_ICBMClientErr{
 			Cookie:     inBody.Cookie,