dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 3fd6bd2c993eb4254b92cd58431685ade9d71534
parent f4df4091b05e425a136a11c599b714fe5bd9e7b7
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 23 May 2023 20:20:38 -0700

Revert "cleanup"

This reverts commit f5e9fc53d7f79f89fe75b519c0cd626fdb6e3e6c.

Diffstat:
Mpkg/web/handlers/handlers.go | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4798,8 +4798,16 @@ func ChessGameHandler(c echo.Context) error { return nil } + quit := make(chan bool) + // Listen to the closing of HTTP connection via CloseNotifier notify := c.Request().Context().Done() + utils.SGo(func() { + select { + case <-notify: + } + close(quit) + }) c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) c.Response().WriteHeader(http.StatusOK) @@ -4826,7 +4834,7 @@ func ChessGameHandler(c echo.Context) error { Loop: for { select { - case <-notify: + case <-quit: break Loop default: } @@ -4891,8 +4899,16 @@ func ChatStreamMessagesHandler(c echo.Context) error { return c.Redirect(http.StatusFound, "/") } + quit := make(chan bool) + // Listen to the closing of HTTP connection via CloseNotifier notify := c.Request().Context().Done() + utils.SGo(func() { + select { + case <-notify: + } + close(quit) + }) c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) c.Response().WriteHeader(http.StatusOK) @@ -4942,7 +4958,7 @@ func ChatStreamMessagesHandler(c echo.Context) error { Loop: for { select { - case <-notify: + case <-quit: break Loop default: }