Skip to content

Commit a6b9464

Browse files
committed
conn: Add noCopy
Closes #349
1 parent b4b86b9 commit a6b9464

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: conn.go

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242
// This applies to context expirations as well unfortunately.
4343
// See https://github.com/nhooyr/websocket/issues/242#issuecomment-633182220
4444
type Conn struct {
45+
noCopy
46+
4547
subprotocol string
4648
rwc io.ReadWriteCloser
4749
client bool
@@ -288,3 +290,6 @@ func (m *mu) unlock() {
288290
default:
289291
}
290292
}
293+
294+
type noCopy struct{}
295+
func (*noCopy) Lock() {}

Diff for: ws_js.go

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const (
4040

4141
// Conn provides a wrapper around the browser WebSocket API.
4242
type Conn struct {
43+
noCopy
4344
ws wsjs.WebSocket
4445

4546
// read limit for a message in bytes.
@@ -563,3 +564,6 @@ func (m *mu) unlock() {
563564
default:
564565
}
565566
}
567+
568+
type noCopy struct{}
569+
func (*noCopy) Lock() {}

0 commit comments

Comments
 (0)