3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 07:29:31 +01:00

shorten the cached batch ID for multilines

This commit is contained in:
Shivaram Lingamneni 2020-12-15 04:11:30 -05:00
parent 94df158c90
commit be31d33dc4

View File

@ -154,8 +154,11 @@ func (m *MessageCache) InitializeSplitMessage(server *Server, nickmask, accountN
}
// we need to send the same batch ID to all recipient sessions;
// use a uuidv4-alike to ensure that it won't collide
batch := composeMultilineBatch(utils.GenerateSecretToken(), nickmask, accountName, tags, command, target, message)
// ensure it doesn't collide. a half-sized token has 64 bits of entropy,
// so a collision isn't expected until there are on the order of 2**32
// concurrent batches being relayed:
batchID := utils.GenerateSecretToken()[:utils.SecretTokenLength/2]
batch := composeMultilineBatch(batchID, nickmask, accountName, tags, command, target, message)
m.fullTagsMultiline = make([][]byte, len(batch))
for i, msg := range batch {
if forceTrailing {