Bläddra i källkod

shorten the cached batch ID for multilines

tags/v2.5.0-rc1
Shivaram Lingamneni 3 år sedan
förälder
incheckning
be31d33dc4
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5
    2
      irc/message_cache.go

+ 5
- 2
irc/message_cache.go Visa fil

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

Laddar…
Avbryt
Spara