(needsLock bool, frameType wsOpCode, payload []byte)
| 749 | } |
| 750 | |
| 751 | func (nc *Conn) wsEnqueueControlMsg(needsLock bool, frameType wsOpCode, payload []byte) { |
| 752 | // In some low-level unit tests it will happen... |
| 753 | if nc == nil { |
| 754 | return |
| 755 | } |
| 756 | if needsLock { |
| 757 | nc.mu.Lock() |
| 758 | defer nc.mu.Unlock() |
| 759 | } |
| 760 | wr, ok := nc.bw.w.(*websocketWriter) |
| 761 | if !ok { |
| 762 | return |
| 763 | } |
| 764 | fh, key := wsCreateFrameHeader(false, frameType, len(payload)) |
| 765 | wr.ctrlFrames = append(wr.ctrlFrames, fh) |
| 766 | if len(payload) > 0 { |
| 767 | wsMaskBuf(key, payload) |
| 768 | wr.ctrlFrames = append(wr.ctrlFrames, payload) |
| 769 | } |
| 770 | nc.bw.flush() |
| 771 | } |
| 772 | |
| 773 | func (nc *Conn) wsUpdateConnectionHeaders(req *http.Request) error { |
| 774 | var headers http.Header |
no test coverage detected