projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
9587: test /trash page
[arvados.git]
/
services
/
ws
/
handler.go
diff --git
a/services/ws/handler.go
b/services/ws/handler.go
index 8d8edcac3417543037bb5397b112d6ca82d51788..72291900fac52c4192f4db971e29bd736be5c189 100644
(file)
--- a/
services/ws/handler.go
+++ b/
services/ws/handler.go
@@
-31,6
+31,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
+53,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
+86,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
@@
-192,7
+198,7
@@
func (h *handler) Handle(ws wsConn, eventSource eventSource, newSession func(wsC
return
}
return
}
-func (h *handler) Status() interface{} {
+func (h *handler)
Debug
Status() interface{} {
h.mtx.Lock()
defer h.mtx.Unlock()
h.mtx.Lock()
defer h.mtx.Unlock()