MCPcopy Index your code
hub / github.com/coder/websocket / Write

Method Write

netconn.go:125–138  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

123}
124
125func (nc *netConn) Write(p []byte) (int, error) {
126 nc.writeMu.forceLock()
127 defer nc.writeMu.unlock()
128
129 if nc.writeExpired.Load() == 1 {
130 return 0, fmt.Errorf("failed to write: %w", context.DeadlineExceeded)
131 }
132
133 err := nc.c.Write(nc.writeCtx, nc.msgType, p)
134 if err != nil {
135 return 0, err
136 }
137 return len(p), nil
138}
139
140func (nc *netConn) Read(p []byte) (int, error) {
141 nc.readMu.forceLock()

Callers

nothing calls this directly

Calls 2

forceLockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected