Преглед изворни кода

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()