@cryptotaxi247 / kubo / commits / d631204de

fix race condition when logging requests

Marten Seemann committed Feb 27, 2021 at 18:33 UTC d631204deeea7da9ee9f6212fd23ef7b67dcebe2
2 files changed +1 -1
commands/context.go
-1
@@ -117,7 +117,6 @@ func (c *Context) LogRequest(req *cmds.Request) func() {
117 Command: strings.Join(req.Path, "/"),
118 Options: req.Options,
119 Args: req.Arguments,
120 - ID: c.ReqLog.nextID,
120 log: c.ReqLog,
121 }
122 c.ReqLog.AddEntry(rle)
commands/reqlog.go
+1
@@ -38,6 +38,7 @@ func (rl *ReqLog) AddEntry(rle *ReqLogEntry) {
38 rl.lock.Lock()
39 defer rl.lock.Unlock()
40
41 + rle.ID = rl.nextID
42 rl.nextID++
43 rl.Requests = append(rl.Requests, rle)
44