summaryrefslogtreecommitdiff
path: root/plugins/websockets/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-27 13:38:51 +0300
committerValery Piashchynski <[email protected]>2021-05-27 13:38:51 +0300
commit1c7c79ffc50721f586c582356d04fd826fc74811 (patch)
treed8207a4c8332dc83780809b5c689278afa5907a2 /plugins/websockets/plugin.go
parent34df1626822613004d0974474c8bbe10cf2f1a94 (diff)
- Add more documetation
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/websockets/plugin.go')
-rw-r--r--plugins/websockets/plugin.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/websockets/plugin.go b/plugins/websockets/plugin.go
index bc5028e6..76ef800d 100644
--- a/plugins/websockets/plugin.go
+++ b/plugins/websockets/plugin.go
@@ -134,8 +134,11 @@ func (p *Plugin) Middleware(next http.Handler) http.Handler {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
+
+ // construct safe connection protected by mutexes
safeConn := connection.NewConnection(_conn, p.log)
defer func() {
+ // close the connection on exit
err = safeConn.Close()
if err != nil {
p.log.Error("connection close error", "error", err)