MCPcopy
hub / github.com/coder/websocket / close

Method close

conn.go:151–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151func (c *Conn) close() error {
152 c.closeMu.Lock()
153 defer c.closeMu.Unlock()
154
155 if c.isClosed() {
156 return net.ErrClosed
157 }
158 runtime.SetFinalizer(c, nil)
159 close(c.closed)
160
161 // Have to close after c.closed is closed to ensure any goroutine that wakes up
162 // from the connection being closed also sees that c.closed is closed and returns
163 // closeErr.
164 err := c.rwc.Close()
165 // With the close of rwc, these become safe to close.
166 c.msgWriter.close()
167 c.msgReader.close()
168 return err
169}
170
171func (c *Conn) setupWriteTimeout(ctx context.Context) bool {
172 if ctx.Done() == nil {

Callers 8

CloseMethod · 0.95
CloseNowMethod · 0.95
newConnFunction · 0.95
setupWriteTimeoutMethod · 0.95
setupReadTimeoutMethod · 0.95
CloseReadMethod · 0.95
handleControlMethod · 0.95
writeFrameMethod · 0.95

Calls 3

isClosedMethod · 0.95
LockMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected