Skip to content
Snippets Groups Projects
Commit 2da3780d authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

removed the dummy messenger

parent 3c12da7f
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,6 @@ Optional args: ...@@ -64,7 +64,6 @@ Optional args:
|--verbose|-v|Verbose mode for debugging|-v| |--verbose|-v|Verbose mode for debugging|-v|
|--version|-V|Show the client version information|-V| |--version|-V|Show the client version information|-V|
|--waitForMessages|-w|Denotes the number of messages the client should receive before closing (default 1)|-w 7| |--waitForMessages|-w|Denotes the number of messages the client should receive before closing (default 1)|-w 7|
|--dummyfrequency| |Frequency of dummy messages in Hz. If no message is passed, will transmit a random message. Dummies are only sent if this flag is passed| --dummyfrequency 30.5|
Runs a client for cMix anonymous communication platform Runs a client for cMix anonymous communication platform
......
...@@ -40,7 +40,6 @@ var destinationUserId uint64 ...@@ -40,7 +40,6 @@ var destinationUserId uint64
var destinationUserIDBase64 string var destinationUserIDBase64 string
var message string var message string
var sessionFile string var sessionFile string
var dummyFrequency float64
var noBlockingTransmission bool var noBlockingTransmission bool
var rateLimiting uint32 var rateLimiting uint32
var showVer bool var showVer bool
...@@ -334,9 +333,6 @@ var rootCmd = &cobra.Command{ ...@@ -334,9 +333,6 @@ var rootCmd = &cobra.Command{
return return
} }
var dummyPeriod time.Duration
var timer *time.Timer
userID, _, client := sessionInitialization() userID, _, client := sessionInitialization()
// Set Key parameters if defined // Set Key parameters if defined
if len(keyParams) == 5 { if len(keyParams) == 5 {
...@@ -363,12 +359,6 @@ var rootCmd = &cobra.Command{ ...@@ -363,12 +359,6 @@ var rootCmd = &cobra.Command{
} }
globals.Log.INFO.Println("Logged In!") globals.Log.INFO.Println("Logged In!")
// Do calculation for dummy messages if the flag is set
if dummyFrequency != 0 {
dummyPeriod = time.Nanosecond *
(time.Duration(float64(1000000000) * (float64(1.0) / dummyFrequency)))
}
cryptoType := parse.Unencrypted cryptoType := parse.Unencrypted
if end2end { if end2end {
cryptoType = parse.E2E cryptoType = parse.E2E
...@@ -434,39 +424,7 @@ var rootCmd = &cobra.Command{ ...@@ -434,39 +424,7 @@ var rootCmd = &cobra.Command{
client.SearchForUser(searchForUser, udbLister) client.SearchForUser(searchForUser, udbLister)
} }
if dummyFrequency != 0 { if message != "" {
timer = time.NewTimer(dummyPeriod)
}
if dummyPeriod != 0 {
for {
// need to constantly send new messages
<-timer.C
contact := ""
u, ok := user.Users.GetUser(recipientId)
if ok {
contact = u.Nick
}
globals.Log.INFO.Printf("Sending Message to %d, %v: %s\n", destinationUserId,
contact, message)
message := &parse.Message{
Sender: userID,
TypedBody: parse.TypedBody{
MessageType: int32(cmixproto.Type_TEXT_MESSAGE),
Body: api.FormatTextMessage(message),
},
InferredType: cryptoType,
Receiver: recipientId}
err := client.Send(message)
if err != nil {
globals.Log.ERROR.Printf("Error sending message: %+v", err)
}
timer = time.NewTimer(dummyPeriod)
}
} else {
// Wait up to 45s to receive a message // Wait up to 45s to receive a message
for end, timeout := false, time.After(45*time.Second); !end; { for end, timeout := false, time.After(45*time.Second); !end; {
numMsgRecieved := atomic.LoadInt64(&text.MessagesReceived) numMsgRecieved := atomic.LoadInt64(&text.MessagesReceived)
...@@ -476,7 +434,7 @@ var rootCmd = &cobra.Command{ ...@@ -476,7 +434,7 @@ var rootCmd = &cobra.Command{
select { select {
case <-timeout: case <-timeout:
fmt.Println("Timing out client, "+ fmt.Printf("Timing out client, "+
"%v/%v message(s) been received", numMsgRecieved, "%v/%v message(s) been received", numMsgRecieved,
waitForMessages) waitForMessages)
end = true end = true
...@@ -592,10 +550,6 @@ func init() { ...@@ -592,10 +550,6 @@ func init() {
rootCmd.Flags().BoolVarP(&showVer, "version", "V", false, rootCmd.Flags().BoolVarP(&showVer, "version", "V", false,
"Show the server version information.") "Show the server version information.")
rootCmd.Flags().Float64VarP(&dummyFrequency, "dummyfrequency", "", 0,
"Frequency of dummy messages in Hz. If no message is passed, "+
"will transmit a random message. Dummies are only sent if this flag is passed")
rootCmd.PersistentFlags().BoolVarP(&end2end, "end2end", "", false, rootCmd.PersistentFlags().BoolVarP(&end2end, "end2end", "", false,
"Send messages with E2E encryption to destination user. Must have found each other via UDB first") "Send messages with E2E encryption to destination user. Must have found each other via UDB first")
......
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