MCPcopy
hub / github.com/gorilla/websocket / ncopy

Method ncopy

conn.go:643–655  ·  view source on GitHub ↗
(max int)

Source from the content-addressed store, hash-verified

641}
642
643func (w *messageWriter) ncopy(max int) (int, error) {
644 n := len(w.c.writeBuf) - w.pos
645 if n <= 0 {
646 if err := w.flushFrame(false, nil); err != nil {
647 return 0, err
648 }
649 n = len(w.c.writeBuf) - w.pos
650 }
651 if n > max {
652 n = max
653 }
654 return n, nil
655}
656
657func (w *messageWriter) Write(p []byte) (int, error) {
658 if w.err != nil {

Callers 2

WriteMethod · 0.95
WriteStringMethod · 0.95

Calls 1

flushFrameMethod · 0.95

Tested by

no test coverage detected