queueOutBytes attempts to send a ServerComMessage already serialized to []byte. If the send buffer is full, it fails.
(data []byte)
| 358 | // queueOutBytes attempts to send a ServerComMessage already serialized to []byte. |
| 359 | // If the send buffer is full, it fails. |
| 360 | func (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 | |
| 377 | func (s *Session) maybeScheduleClusterWriteLoop() { |
| 378 | if s.multi != nil { |
no test coverage detected