diff --git a/conn.go b/conn.go index 97e1dba..0b78e0d 100644 --- a/conn.go +++ b/conn.go @@ -235,7 +235,6 @@ type Conn struct { writeBuf []byte // frame is constructed in this buffer. writeDeadline time.Time writer io.WriteCloser // the current writer returned to the application - isWriting bool // for best-effort concurrent write detection writeErrMu sync.Mutex writeErr error @@ -581,18 +580,8 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error { // concurrent writes. See the concurrency section in the package // documentation for more info. - if c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = true - err := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra) - if !c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = false - if err != nil { return w.fatal(err) } @@ -713,15 +702,7 @@ func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error { if err != nil { return err } - if c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = true err = c.write(frameType, c.writeDeadline, frameData, nil) - if !c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = false return err }