:[VOL-1884] Afrouter does not Stop on Shutdown Signal if Streaming Request Open
Change-Id: Iec611fc60a9a17aa5d5713b0f84e905406ee4164
diff --git a/internal/pkg/afrouter/signals.go b/internal/pkg/afrouter/signals.go
index 950537c..24ae7ee 100644
--- a/internal/pkg/afrouter/signals.go
+++ b/internal/pkg/afrouter/signals.go
@@ -62,6 +62,23 @@
}
func cleanExit(err error) {
+
+ //Closing the streaming connections
+ for _, cl := range clusters {
+ for _, bknd := range cl.backends {
+ log.Debugf("Closing backend %s", bknd.name)
+ for streamReq := range bknd.activeRequests {
+ if streamReq.isStreamingResponse || streamReq.isStreamingRequest {
+ connection := streamReq.backend.connections
+ for _, conn := range connection {
+ log.Debugf("Forcefully closing connection %s serving Streaming request/response", conn.name)
+ conn.close()
+ }
+ }
+ }
+ }
+ }
+
// Log the shutdown
if arProxy != nil {
for _, srvr := range arProxy.servers {
@@ -72,15 +89,7 @@
}
}
}
- for _, cl := range clusters {
- for _, bknd := range cl.backends {
- log.Debugf("Closing backend %s", bknd.name)
- for _, conn := range bknd.connections {
- log.Debugf("Closing connection %s", conn.name)
- conn.close()
- }
- }
- }
+
doneChan <- err
//os.Exit(0)
}