cmd: crio: correctly stop the streaming server

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-09-26 16:24:55 +02:00
parent d6e819133d
commit 91d9b4fc29
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -162,8 +162,7 @@ func catchShutdown(gserver *grpc.Server, sserver *server.Server, hserver *http.S
*signalled = true *signalled = true
gserver.GracefulStop() gserver.GracefulStop()
hserver.Shutdown(context.Background()) hserver.Shutdown(context.Background())
// TODO(runcom): enable this after https://github.com/kubernetes/kubernetes/pull/51377 sserver.StopStreamServer()
//sserver.StopStreamServer()
sserver.StopExitMonitor() sserver.StopExitMonitor()
if err := sserver.Shutdown(); err != nil { if err := sserver.Shutdown(); err != nil {
logrus.Warnf("error shutting down main service %v", err) logrus.Warnf("error shutting down main service %v", err)
@ -503,21 +502,18 @@ func main() {
} }
}() }()
// TODO(runcom): enable this after https://github.com/kubernetes/kubernetes/pull/51377 streamServerCloseCh := service.StreamingServerCloseChan()
//streamServerCloseCh := service.StreamingServerCloseChan()
serverExitMonitorCh := service.ExitMonitorCloseChan() serverExitMonitorCh := service.ExitMonitorCloseChan()
select { select {
// TODO(runcom): enable this after https://github.com/kubernetes/kubernetes/pull/51377 case <-streamServerCloseCh:
//case <-streamServerCloseCh:
case <-serverExitMonitorCh: case <-serverExitMonitorCh:
case <-serverCloseCh: case <-serverCloseCh:
} }
service.Shutdown() service.Shutdown()
// TODO(runcom): enable this after https://github.com/kubernetes/kubernetes/pull/51377 <-streamServerCloseCh
//<-streamServerCloseCh logrus.Debug("closed stream server")
//logrus.Debug("closed stream server")
<-serverExitMonitorCh <-serverExitMonitorCh
logrus.Debug("closed exit monitor") logrus.Debug("closed exit monitor")
<-serverCloseCh <-serverCloseCh