This commit is contained in:
@@ -26,8 +26,8 @@ type ReceivedMessage struct {
|
||||
Location meowlib.Location
|
||||
}
|
||||
|
||||
// CheckForMessages checks for messages on a single server
|
||||
func CheckForMessages(storage_path string, job *client.RequestsJob, timeout int, longPoll bool) (int, string, error) {
|
||||
// PollServer checks for messages on a single server
|
||||
func PollServer(storage_path string, job *client.RequestsJob, timeout int, longPoll bool) (int, string, error) {
|
||||
|
||||
count := 0
|
||||
|
||||
@@ -111,8 +111,8 @@ func SaveCheckJobs() (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// ReadMessage
|
||||
func ReadMessage(messageFilename string) ([]string, []string, string, error) {
|
||||
// ConsumeInboxFile
|
||||
func ConsumeInboxFile(messageFilename string) ([]string, []string, string, error) {
|
||||
|
||||
messagesOverview := []string{}
|
||||
filenames := []string{}
|
||||
@@ -150,7 +150,7 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) {
|
||||
//fmt.Println("From:", usermsg.From)
|
||||
//jsonUserMessage, _ := json.Marshal(usermsg)
|
||||
//fmt.Println(string(jsonUserMessage))
|
||||
peer = client.GetConfig().GetIdentity().Peers.GetFromPublicKey(usermsg.From)
|
||||
//peer = client.GetConfig().GetIdentity().Peers.GetFromPublicKey(usermsg.From)
|
||||
|
||||
// detach files
|
||||
if usermsg.Files != nil {
|
||||
@@ -177,6 +177,8 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) {
|
||||
if err != nil {
|
||||
return nil, nil, "ReadMessage: StoreMessage", err
|
||||
}
|
||||
filenames = []string{}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +191,8 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) {
|
||||
return messagesOverview, filenames, "", nil
|
||||
}
|
||||
|
||||
// CheckForMessages checks for messages on a single server
|
||||
func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout int, longPoll bool) (int, string, error) {
|
||||
// LongPollAllSerevrJobs checks for messages on a all servers defived in job file
|
||||
func LongPollAllSerevrJobs(storage_path string, jobs []client.RequestsJob, timeout int, longPoll bool) (int, string, error) {
|
||||
|
||||
// Channel to collect results
|
||||
resultChan := make(chan int, len(jobs))
|
||||
@@ -207,7 +209,7 @@ func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout
|
||||
defer wg.Done()
|
||||
|
||||
// Long-polling call to the server
|
||||
cnt, _, err := CheckForMessages(storage_path, &job, timeout, true)
|
||||
cnt, _, err := PollServer(storage_path, &job, timeout, true)
|
||||
|
||||
if err == nil && cnt > 0 {
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user