mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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.
This commit is contained in:
parent
8af76115cb
commit
9e4a003fb0
@ -323,7 +323,7 @@ func startEtcd(cfg *config) (<-chan struct{}, error) {
|
|||||||
grpcServer := grpc.NewServer()
|
grpcServer := grpc.NewServer()
|
||||||
etcdserverpb.RegisterKVServer(grpcServer, v3rpc.NewKVServer(s))
|
etcdserverpb.RegisterKVServer(grpcServer, v3rpc.NewKVServer(s))
|
||||||
etcdserverpb.RegisterWatchServer(grpcServer, v3rpc.NewWatchServer(s.Watchable()))
|
etcdserverpb.RegisterWatchServer(grpcServer, v3rpc.NewWatchServer(s.Watchable()))
|
||||||
go plog.Fatal(grpcServer.Serve(v3l))
|
go func() { plog.Fatal(grpcServer.Serve(v3l)) }()
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.StopNotify(), nil
|
return s.StopNotify(), nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user