Merge pull request 'Fix infinite loop on fresh server' (#3) from infnite-fix into trunk
Reviewed-on: #3 works
This commit is contained in:
commit
a2bed9b884
|
@ -109,7 +109,7 @@ func (ta *TokenboardServer) postMessageRequest(pr groups.PostRequest) {
|
||||||
if err := ta.TokenService.SpendToken(pr.Token, append(pr.EGM.ToBytes(), ta.connection.ID().Hostname()...)); err == nil {
|
if err := ta.TokenService.SpendToken(pr.Token, append(pr.EGM.ToBytes(), ta.connection.ID().Hostname()...)); err == nil {
|
||||||
|
|
||||||
// ignore messages with no signatures
|
// ignore messages with no signatures
|
||||||
if len(pr.EGM.Signature) == 0 {
|
if len(pr.EGM.Signature) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,15 @@ func (s SqliteMessageStore) FetchMessagesFrom(signature []byte) []*groups.Encryp
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
return s.compileRows(rows)
|
messages := s.compileRows(rows)
|
||||||
|
|
||||||
|
// if we don't have *any* messages then either the signature next existed
|
||||||
|
// or the server purged it...either way treat this as a full sync...
|
||||||
|
if len(messages) < 1 {
|
||||||
|
return s.FetchMessages()
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SqliteMessageStore) compileRows(rows *sql.Rows) []*groups.EncryptedGroupMessage {
|
func (s *SqliteMessageStore) compileRows(rows *sql.Rows) []*groups.EncryptedGroupMessage {
|
||||||
|
@ -92,13 +100,6 @@ func (s *SqliteMessageStore) compileRows(rows *sql.Rows) []*groups.EncryptedGrou
|
||||||
Ciphertext: rawCiphertext,
|
Ciphertext: rawCiphertext,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we don't have *any* messages then either the signature next existed
|
|
||||||
// or the server purged it...either way treat this as a full sync...
|
|
||||||
if len(messages) < 1 {
|
|
||||||
return s.FetchMessages()
|
|
||||||
}
|
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue