Skip to content
Snippets Groups Projects
Commit 64f23752 authored by benjamin's avatar benjamin
Browse files

made message status updates only come from pickup up the message from the network

parent 5f4afe50
No related branches found
No related tags found
4 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!397Fully Decentralized channels,!340Project/channels
...@@ -95,14 +95,14 @@ func loadSendTracker(net Client, kv *versioned.KV, trigger triggerEventFunc, ...@@ -95,14 +95,14 @@ func loadSendTracker(net Client, kv *versioned.KV, trigger triggerEventFunc,
st.load() st.load()
//denote all unsent messages as failed and clear //denote all unsent messages as failed and clear
for uuid := range st.unsent { for uuid, t := range st.unsent {
updateStatus(uuid, cryptoChannel.MessageID{}, updateStatus(uuid, t.MsgID,
time.Time{}, rounds.Round{}, Failed) time.Time{}, rounds.Round{}, Failed)
} }
st.unsent = make(map[uint64]*tracked) st.unsent = make(map[uint64]*tracked)
//register to check all outstanding rounds when the network becomes healthy //register to check all outstanding rounds when the network becomes healthy
var callBackID uint64 /*var callBackID uint64
callBackID = net.AddHealthCallback(func(f bool) { callBackID = net.AddHealthCallback(func(f bool) {
if !f { if !f {
return return
...@@ -116,7 +116,7 @@ func loadSendTracker(net Client, kv *versioned.KV, trigger triggerEventFunc, ...@@ -116,7 +116,7 @@ func loadSendTracker(net Client, kv *versioned.KV, trigger triggerEventFunc,
} }
st.net.GetRoundResults(getRoundResultsTimeout, rr.callback, rr.round) st.net.GetRoundResults(getRoundResultsTimeout, rr.callback, rr.round)
} }
}) })*/
return st return st
} }
...@@ -315,19 +315,19 @@ func (st *sendTracker) handleSend(uuid uint64, ...@@ -315,19 +315,19 @@ func (st *sendTracker) handleSend(uuid uint64,
t.RoundID = round.ID t.RoundID = round.ID
//add the roundID //add the roundID
roundsList, existsRound := st.byRound[round.ID] roundsList, _ := st.byRound[round.ID]
st.byRound[round.ID] = append(roundsList, t) st.byRound[round.ID] = append(roundsList, t)
//add the round //add the round
st.byMessageID[messageID] = t st.byMessageID[messageID] = t
if !existsRound { /*if !existsRound {
rr := &roundResults{ rr := &roundResults{
round: round.ID, round: round.ID,
st: st, st: st,
} }
st.net.GetRoundResults(getRoundResultsTimeout, rr.callback, rr.round) st.net.GetRoundResults(getRoundResultsTimeout, rr.callback, rr.round)
} }*/
//store the changed list to disk //store the changed list to disk
err := st.storeSent() err := st.storeSent()
...@@ -374,6 +374,10 @@ func (st *sendTracker) MessageReceive(messageID cryptoChannel.MessageID) bool { ...@@ -374,6 +374,10 @@ func (st *sendTracker) MessageReceive(messageID cryptoChannel.MessageID) bool {
st.byRound[msgData.RoundID] = newRoundList st.byRound[msgData.RoundID] = newRoundList
} }
if err := st.storeSent(); err != nil {
jww.FATAL.Panicf("failed to store the updated sent list: %+v", err)
}
return true return true
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment