s.router.Use(gin.Recovery())
s.router.Use(s.middlewareXDSDetails())
s.router.Use(s.middlewareCORS())
+ s.router.Use(s.lockRequest())
// Create REST API
s.api = NewAPIV1(s.Context)
}
}
+func (s *WebServer) lockRequest() gin.HandlerFunc {
+ return func(c *gin.Context) {
+ s.lock.Lock()
+ s.lock.LockCpt++
+ s.lock.Unlock()
+ c.Next()
+ s.lock.Lock()
+ s.lock.LockCpt--
+ s.lock.Unlock()
+ }
+}
+
// socketHandler is the handler for the "main" websocket connection
func (s *WebServer) socketHandler(c *gin.Context) {