浏览代码

lib/connections: Correct race on loop variable (fixes #8320) (#8321)

Jakob Borg 3 年之前
父节点
当前提交
ce0ded7c78
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/connections/service.go

+ 1 - 1
lib/connections/service.go

@@ -228,8 +228,8 @@ func NewService(cfg config.Wrapper, myID protocol.DeviceID, mdl Model, tlsCfg *t
 }
 }
 
 
 func (s *service) handleConns(ctx context.Context) error {
 func (s *service) handleConns(ctx context.Context) error {
-	var c internalConn
 	for {
 	for {
+		var c internalConn
 		select {
 		select {
 		case <-ctx.Done():
 		case <-ctx.Done():
 			return ctx.Err()
 			return ctx.Err()