From 3ae43eba16e1840e2a457c2a80e6c6b10a6e3eb6 Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Wed, 3 Jan 2024 22:02:44 +0100 Subject: [PATCH] hot fix: close client on verifying connection (will keep client open) --- machinery/src/capture/main.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/machinery/src/capture/main.go b/machinery/src/capture/main.go index 758e83f..16b9830 100644 --- a/machinery/src/capture/main.go +++ b/machinery/src/capture/main.go @@ -564,17 +564,23 @@ func VerifyCamera(c *gin.Context) { } } - if videoIdx > -1 { - c.JSON(200, models.APIResponse{ - Message: "All good, detected a H264 codec.", - Data: streams, - }) + err := rtspClient.Close() + if err == nil { + if videoIdx > -1 { + c.JSON(200, models.APIResponse{ + Message: "All good, detected a H264 codec.", + Data: streams, + }) + } else { + c.JSON(400, models.APIResponse{ + Message: "Stream doesn't have a H264 codec, we only support H264 so far.", + }) + } } else { c.JSON(400, models.APIResponse{ - Message: "Stream doesn't have a H264 codec, we only support H264 so far.", + Message: "Something went wrong while closing the connection " + err.Error(), }) } - } else { c.JSON(400, models.APIResponse{ Message: err.Error(),