MCPcopy
hub / github.com/tinode/chat / queueOutBytes

Method queueOutBytes

server/session.go:360–375  ·  view source on GitHub ↗

queueOutBytes attempts to send a ServerComMessage already serialized to []byte. If the send buffer is full, it fails.

(data []byte)

Source from the content-addressed store, hash-verified

358// queueOutBytes attempts to send a ServerComMessage already serialized to []byte.
359// If the send buffer is full, it fails.
360func (s *Session) queueOutBytes(data []byte) bool {
361 if s == nil || atomic.LoadInt32(&s.terminating) > 0 {
362 return true
363 }
364
365 select {
366 case s.send <- data:
367 default:
368 logs.Err.Println("s.queueOutBytes: session's send queue full", s.sid)
369 return false
370 }
371 if s.isMultiplex() {
372 s.scheduleClusterWriteLoop()
373 }
374 return true
375}
376
377func (s *Session) maybeScheduleClusterWriteLoop() {
378 if s.multi != nil {

Callers 1

dispatchRawMethod · 0.95

Calls 3

isMultiplexMethod · 0.95
PrintlnMethod · 0.80

Tested by

no test coverage detected