projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '2411-check-copyright'
[arvados.git]
/
services
/
ws
/
handler.go
diff --git
a/services/ws/handler.go
b/services/ws/handler.go
index ca9231c986de0f75e0655e506b8590c1b17d3d84..f9f7f53edc58430f231e9a52d5d95bb1a025084a 100644
(file)
--- a/
services/ws/handler.go
+++ b/
services/ws/handler.go
@@
-1,3
+1,7
@@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
package main
import (
package main
import (
@@
-31,6
+35,7
@@
func (h *handler) Handle(ws wsConn, eventSource eventSource, newSession func(wsC
h.setupOnce.Do(h.setup)
ctx, cancel := context.WithCancel(ws.Request().Context())
h.setupOnce.Do(h.setup)
ctx, cancel := context.WithCancel(ws.Request().Context())
+ defer cancel()
log := logger(ctx)
incoming := eventSource.NewSink()
log := logger(ctx)
incoming := eventSource.NewSink()
@@
-52,6
+57,8
@@
func (h *handler) Handle(ws wsConn, eventSource eventSource, newSession func(wsC
return
}
return
}
+ // Receive websocket frames from the client and pass them to
+ // sess.Receive().
go func() {
buf := make([]byte, 2<<20)
for {
go func() {
buf := make([]byte, 2<<20)
for {
@@
-83,6
+90,9
@@
func (h *handler) Handle(ws wsConn, eventSource eventSource, newSession func(wsC
}
}()
}
}()
+ // Take items from the outgoing queue, serialize them using
+ // sess.EventMessage() as needed, and send them to the client
+ // as websocket frames.
go func() {
for {
var ok bool
go func() {
for {
var ok bool