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