Skip to content
Snippets Groups Projects
Commit 52beafb4 authored by benjamin's avatar benjamin
Browse files

fixed dummy messages

parent bf65680e
No related branches found
No related tags found
3 merge requests!510Release,!424Hotfix/fast sending,!340Project/channels
...@@ -78,8 +78,7 @@ func (m mockCmix) Follow(report cmix.ClientErrorReport) (stoppable.Stoppable, er ...@@ -78,8 +78,7 @@ func (m mockCmix) Follow(report cmix.ClientErrorReport) (stoppable.Stoppable, er
} }
func (m mockCmix) GetMaxMessageLength() int { func (m mockCmix) GetMaxMessageLength() int {
//TODO implement me return 100
panic("implement me")
} }
func (m *mockCmix) SendMany(messages []cmix.TargetedCmixMessage, p cmix.CMIXParams) (rounds.Round, []ephemeral.Id, error) { func (m *mockCmix) SendMany(messages []cmix.TargetedCmixMessage, p cmix.CMIXParams) (rounds.Round, []ephemeral.Id, error) {
......
...@@ -49,7 +49,7 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) ( ...@@ -49,7 +49,7 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) (
} }
// Generate random message payload // Generate random message payload
payloadSize := m.store.GetCmixGroup().GetP().ByteLen() payloadSize := m.net.GetMaxMessageLength()
payload, err = newRandomPayload(payloadSize, rng) payload, err = newRandomPayload(payloadSize, rng)
if err != nil { if err != nil {
return nil, format.Fingerprint{}, message.Service{}, nil, nil, return nil, format.Fingerprint{}, message.Service{}, nil, nil,
...@@ -79,13 +79,8 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) ( ...@@ -79,13 +79,8 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) (
// newRandomPayload generates a random payload of a random length // newRandomPayload generates a random payload of a random length
// within the maxPayloadSize. // within the maxPayloadSize.
func newRandomPayload(maxPayloadSize int, rng csprng.Source) ([]byte, error) { func newRandomPayload(maxPayloadSize int, rng csprng.Source) ([]byte, error) {
// Generate random payload size
randomPayloadSize, err := randomInt(maxPayloadSize, rng)
if err != nil {
return nil, errors.Errorf(payloadSizeRngErr, err)
}
randomMsg, err := csprng.Generate(randomPayloadSize, rng) randomMsg, err := csprng.Generate(maxPayloadSize, rng)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -75,16 +75,16 @@ func Test_durationRng_Consistency(t *testing.T) { ...@@ -75,16 +75,16 @@ func Test_durationRng_Consistency(t *testing.T) {
// when using a PRNG and that the result is not larger than the max payload. // when using a PRNG and that the result is not larger than the max payload.
func Test_newRandomPayload_Consistency(t *testing.T) { func Test_newRandomPayload_Consistency(t *testing.T) {
expectedPayloads := []string{ expectedPayloads := []string{
"l7ufS7Ry6J9bFITyUgnJ", "U4x/lrFkvxuXu59LtHLon1sUhPJSCcnZND6SugndnVLf15tNdkKbYXoMn58NO6VbDMDWFEyIhTWEGsvgcJsHWA==",
"Ut/Xm012Qpthegyfnw07pVsMwNYUTIiFNQ==", "CD9h03W8ArQd9PkZKeGP2p5vguVOdI6B555LvW/jTNy6hD7o1j6MT/4c6+pUbY+sE90arATOLqKHfFV5z6LHjg==",
"CD9h", "GwuvrogbgqdREIpC7TyQPKpDRlp4YgYWl4rtDOPGxPOue8PgSVtXEv79vgwQKIfhANrNLYhfaSy2B9oAoRwccA==",
"GSnh", "ceeWotwtwlpbdLLhKXBeJz8FySMmgo4rBW44F2WOEGFJiUf980RBDtTBFgI/qONXa2/tJ/+JdLrAyv2a0FaSsQ==",
"joE=", "NhnnOJZN/ceejVNDc2Yc/WbXT+weG4lJGrcjbkt1IWKQzyvrQsPKJzKFYPGqwGfOpui/RtSrK0aAQCxfsoIOiA==",
"uoQ+6NY+jE/+HOvqVG2PrBPdGqwEzi6ih3xVec+ix44bC6+uiBuCpw==", "XTJg8d6XgoPUoJo2+WwglBdG4+1NpkaprotPp7T8OiC6+hp17TJ6hriww5rxz9KztRIZ6nlTOr9EjSxHnTJgdQ==",
"qkNGWnhiBhaXiu0M48bE8657w+BJW1cS/v2+DBAoh+EA2s0tiF9pLLYH2gChHBxwcec=", "M5BZFMjMHPCdo54Okp0CSry8sWk5e7c05+8KbgHxhU3rX+Qk/vesIQiR9ZdeKSqiuKoEfGHNszNz6+csJ6CYwA==",
"suEpcF4nPwXJIyaCjisFbg==", "IZfa5rcyw1HfZo+HTiyfHOCcqGAX5+IXSDA/9BwbI+EcSO0XU51oX3byp5i8ZN4OXbKGSyrTwmzmOCNCdloT1g==",
"R/3zREEO1MEWAj+o41drb+0n/4l0usDK/ZrQVpKxNhnnOJZN/ceejVNDc2Yc/WbXTw==", "luUt92D2w0ZeKaDcpGrDoNVwEzvCFXH19UpkMQVRP9hCmxlK4bqfKoOGrnKzZh/oLCrGTb9GFRgk4jBTEmN8mQ==",
"bkt1IQ==", "wrh9bfDdXvKDZxkHLWcvYfqgvob0V5Iew3wORgzw1wPQfcX1ZhpFATNAmnEramar17plIkyiaXjZpc5i/rEagw==",
} }
prng := NewPrng(42) prng := NewPrng(42)
......
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