Skip to content
Snippets Groups Projects
Commit 420268db authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

SendUnsafe passing integration

parent ed71494e
Branches
Tags
No related merge requests found
......@@ -132,7 +132,7 @@ var rootCmd = &cobra.Command{
swboard := client.GetSwitchboard()
recvCh := make(chan message.Receive, 10)
listenerID := swboard.RegisterChannel("raw",
switchboard.AnyUser(), message.Raw, recvCh)
switchboard.AnyUser(), message.Text, recvCh)
jww.INFO.Printf("Message ListenerID: %v", listenerID)
err := client.StartNetworkFollower()
......@@ -150,18 +150,22 @@ var rootCmd = &cobra.Command{
//recipientID := getUIDFromString(viper.GetString("destid"))
recipientID := user.ID
msg := client.NewCMIXMessage(recipientID, []byte(msgBody))
params := params.GetDefaultCMIX()
msg := message.Send{
Recipient: recipientID,
Payload: []byte(msgBody),
MessageType: message.Text,
}
params := params.GetDefaultUnsafe()
sendCnt := int(viper.GetUint("sendCount"))
sendDelay := time.Duration(viper.GetUint("sendDelay"))
for i := 0; i < sendCnt; i++ {
fmt.Printf("Sending to %s: %s\n", recipientID, msgBody)
roundID, err := client.SendCMIX(msg, params)
roundIDs, err := client.SendUnsafe(msg, params)
if err != nil {
jww.FATAL.Panicf("%+v", err)
}
jww.INFO.Printf("RoundID: %d\n", roundID)
jww.INFO.Printf("RoundIDs: %+v\n", roundIDs)
time.Sleep(sendDelay * time.Millisecond)
}
......
......@@ -42,6 +42,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round,
for i, p := range partitions {
msgCmix := format.NewMessage(m.Session.Cmix().GetGroup().GetP().ByteLen())
msgCmix.SetContents(p)
msgCmix.SetRecipientID(msg.Recipient)
e2e.SetUnencrypted(msgCmix, msg.Recipient)
wg.Add(1)
go func(i int) {
......@@ -54,6 +55,8 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round,
}(i)
}
wg.Wait()
//see if any parts failed to send
numFail, errRtn := getSendErrors(errCh)
if numFail > 0 {
......
......@@ -37,7 +37,7 @@ func (m *manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round,
" to end encryption, they have limited security and privacy " +
"preserving properties")
return m.SendUnsafe(msg, param)
return m.message.SendUnsafe(msg, param)
}
// SendE2E sends an end-to-end payload to the provided recipient with
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment