diff --git a/client/helpers/backgroundHelper.go b/client/helpers/backgroundHelper.go index 34a23b1..5661c23 100644 --- a/client/helpers/backgroundHelper.go +++ b/client/helpers/backgroundHelper.go @@ -192,7 +192,7 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) { } // CheckForMessages checks for messages on a single server -func LongPollForMessages(storage_path string, jobs []*client.RequestsJob, timeout int, longPoll bool) (int, string, error) { +func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout int, longPoll bool) (int, string, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -203,7 +203,7 @@ func LongPollForMessages(storage_path string, jobs []*client.RequestsJob, timeou for _, job := range jobs { wg.Add(1) - go func(job *client.RequestsJob) { + go func(job client.RequestsJob) { defer wg.Done() for { @@ -211,7 +211,7 @@ func LongPollForMessages(storage_path string, jobs []*client.RequestsJob, timeou case <-ctx.Done(): return default: - cnt, _, err := CheckForMessages(storage_path, job, timeout, true) + cnt, _, err := CheckForMessages(storage_path, &job, timeout, true) if err != nil { continue // Optionally handle/log error } diff --git a/client/identity.go b/client/identity.go index 85e20ab..2c8d297 100644 --- a/client/identity.go +++ b/client/identity.go @@ -276,7 +276,7 @@ func (id *Identity) generateRandomHiddenStuff() { type BackgroundJob struct { RootPublic string `json:"root_public,omitempty"` Device meowlib.KeyPair `json:"device,omitempty"` - Jobs []*RequestsJob `json:"jobs,omitempty"` + Jobs []RequestsJob `json:"jobs,omitempty"` } type RequestsJob struct { @@ -284,8 +284,8 @@ type RequestsJob struct { LookupKeys []meowlib.KeyPair `json:"lookup_keys,omitempty"` } -func (id *Identity) GetRequestJobs() []*RequestsJob { - var list []*RequestsJob +func (id *Identity) GetRequestJobs() []RequestsJob { + var list []RequestsJob srvs := map[string]*RequestsJob{} // get all servers servers, err := id.MessageServers.LoadAllServers() @@ -320,7 +320,7 @@ func (id *Identity) GetRequestJobs() []*RequestsJob { // build list for _, srv := range srvs { if len(srv.LookupKeys) > 0 { - list = append(list, srv) + list = append(list, *srv) } } } diff --git a/endtoend_test.go b/endtoend_test.go index 113c796..a6d205f 100644 --- a/endtoend_test.go +++ b/endtoend_test.go @@ -85,7 +85,8 @@ func TestEndToEnd(t *testing.T) { ///////////////////////////////////// // Create a message to that friend // ///////////////////////////////////// - MyFirstFriend := Me.Peers[0] + peers, _ := Me.Peers.GetPeers() + MyFirstFriend := peers[0] textmessage := "Hello friend!" // Creating User message usermessage, err := MyFirstFriend.BuildSimpleUserMessage([]byte(textmessage))