Skip to content
Snippets Groups Projects
Commit 19f1732c authored by David Stainton's avatar David Stainton
Browse files

WIP

parent e9d4cb3e
No related branches found
No related tags found
6 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!371[Channel RSAtoPrivate] Implement Reverse Asymmetric in Client/Broadcast,!354Channels impl,!340Project/channels,!338Xx 4055/channel identity tracking
...@@ -27,6 +27,41 @@ type testNetworkManager struct { ...@@ -27,6 +27,41 @@ type testNetworkManager struct {
responseProcessor message.Processor responseProcessor message.Processor
} }
func (tnm *testNetworkManager) SendWithAssembler(recipient *id.ID, assembler cmix.MessageAssembler,
cmixParams cmix.CMIXParams) (id.Round, ephemeral.Id, error) {
msg := format.NewMessage(tnm.instance.GetE2EGroup().GetP().ByteLen())
var rid id.Round = 123
ephemeralId := new(ephemeral.Id)
fingerprint, service, payload, mac, err := assembler(rid)
if err != nil {
return rid, *ephemeralId, err
}
// Build message. Will panic if inputs are not correct.
msg.SetKeyFP(fingerprint)
msg.SetContents(payload)
msg.SetMac(mac)
msg.SetSIH(service.Hash(msg.GetContents()))
// If the recipient for a call to Send is UD, then this
// is the request pathway. Call the UD processor to simulate
// the UD picking up the request
if bytes.Equal(tnm.instance.GetFullNdf().
Get().UDB.ID,
recipient.Bytes()) {
tnm.responseProcessor.Process(msg, receptionID.EphemeralIdentity{}, rounds.Round{})
} else {
// This should happen when the mock UD service Sends back a response.
// Calling process mocks up the requester picking up the response.
tnm.requestProcess.Process(msg, receptionID.EphemeralIdentity{}, rounds.Round{})
}
return 0, ephemeral.Id{}, nil
}
func (tnm *testNetworkManager) Send(recipient *id.ID, fingerprint format.Fingerprint, func (tnm *testNetworkManager) Send(recipient *id.ID, fingerprint format.Fingerprint,
service message.Service, service message.Service,
payload, mac []byte, cmixParams cmix.CMIXParams) (id.Round, ephemeral.Id, error) { payload, mac []byte, cmixParams cmix.CMIXParams) (id.Round, ephemeral.Id, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment