Selaa lähdekoodia

etcdmain: fix unstoppable startEtcd function

We should wrap the blocking function with a closure. And first
creates a go routine to execute the function. Or the inner function
blocks before creating the go routine.
Xiang Li 10 vuotta sitten
vanhempi
commit
9e4a003fb0
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      etcdmain/etcd.go

+ 1 - 1
etcdmain/etcd.go

@@ -323,7 +323,7 @@ func startEtcd(cfg *config) (<-chan struct{}, error) {
 		grpcServer := grpc.NewServer()
 		etcdserverpb.RegisterKVServer(grpcServer, v3rpc.NewKVServer(s))
 		etcdserverpb.RegisterWatchServer(grpcServer, v3rpc.NewWatchServer(s.Watchable()))
-		go plog.Fatal(grpcServer.Serve(v3l))
+		go func() { plog.Fatal(grpcServer.Serve(v3l)) }()
 	}
 
 	return s.StopNotify(), nil