Fix sync protocol integration tests

This commit is contained in:
mcrakhman 2023-06-06 22:08:06 +02:00
parent 100e7e04c3
commit 8310cb3c05
No known key found for this signature in database
GPG Key ID: DED12CFEF5B8396B

View File

@ -240,9 +240,6 @@ func (h *testSyncHandler) HandleMessage(ctx context.Context, senderId string, re
} }
func (h *testSyncHandler) manager() *requestPeerManager { func (h *testSyncHandler) manager() *requestPeerManager {
if h.SyncHandler != nil {
return h.manager()
}
return h.peerManager return h.peerManager
} }
@ -275,10 +272,18 @@ func (h *testSyncHandler) run(ctx context.Context, t *testing.T, wg *sync.WaitGr
h.tree().Unlock() h.tree().Unlock()
continue continue
} }
err = h.HandleMessage(ctx, res.senderId, res.msg) if res.description().name == "FullSyncRequest" {
if err != nil { resp, err := h.HandleRequest(ctx, res.senderId, res.msg)
fmt.Println("error handling message", err.Error()) if err != nil {
continue fmt.Println("error handling request", err.Error())
continue
}
h.peerManager.SendPeer(ctx, res.senderId, resp)
} else {
err = h.HandleMessage(ctx, res.senderId, res.msg)
if err != nil {
fmt.Println("error handling message", err.Error())
}
} }
} }
}() }()