commit 77a9d9361b2100bb676528f85400e033826eef98
parent b9b4931bdea064808ef6df36772d1f8b6fcdb492
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 23 May 2023 08:28:22 -0700
simplify code
Diffstat:
1 file changed, 0 insertions(+), 29 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -29,7 +29,6 @@ import (
"net/http"
"net/url"
"os"
- "os/signal"
"path/filepath"
"regexp"
"sort"
@@ -4800,28 +4799,16 @@ func ChessGameHandler(c echo.Context) error {
}
quit := make(chan bool)
- quit1 := make(chan bool)
// Listen to the closing of HTTP connection via CloseNotifier
notify := c.Request().Context().Done()
utils.SGo(func() {
select {
case <-notify:
- case <-quit1:
}
close(quit)
})
- notify1 := make(chan os.Signal)
- signal.Notify(notify1, os.Interrupt)
- utils.SGo(func() {
- select {
- case <-notify1:
- case <-quit:
- }
- close(quit1)
- })
-
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
c.Response().WriteHeader(http.StatusOK)
c.Response().Header().Set("Transfer-Encoding", "chunked")
@@ -4849,8 +4836,6 @@ Loop:
select {
case <-quit:
break Loop
- case <-quit1:
- break Loop
default:
}
@@ -4915,28 +4900,16 @@ func ChatStreamMessagesHandler(c echo.Context) error {
}
quit := make(chan bool)
- quit1 := make(chan bool)
// Listen to the closing of HTTP connection via CloseNotifier
notify := c.Request().Context().Done()
utils.SGo(func() {
select {
case <-notify:
- case <-quit1:
}
close(quit)
})
- notify1 := make(chan os.Signal)
- signal.Notify(notify1, os.Interrupt)
- utils.SGo(func() {
- select {
- case <-notify1:
- case <-quit:
- }
- close(quit1)
- })
-
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
c.Response().WriteHeader(http.StatusOK)
c.Response().Header().Set("Transfer-Encoding", "chunked")
@@ -4976,8 +4949,6 @@ Loop:
select {
case <-quit:
break Loop
- case <-quit1:
- break Loop
default:
}