Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Revert "add mutex for write/close" #73

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions conn_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type Conn struct {
DefaultMessageType int
reader io.Reader
closeOnce sync.Once
mx sync.Mutex
}

func (c *Conn) Read(b []byte) (int, error) {
Expand Down Expand Up @@ -68,9 +67,6 @@ func (c *Conn) prepNextReader() error {
}

func (c *Conn) Write(b []byte) (n int, err error) {
c.mx.Lock()
defer c.mx.Unlock()

if err := c.Conn.WriteMessage(c.DefaultMessageType, b); err != nil {
return 0, err
}
Expand All @@ -82,9 +78,6 @@ func (c *Conn) Write(b []byte) (n int, err error) {
// close error, subsequent and concurrent calls will return nil.
// This method is thread-safe.
func (c *Conn) Close() error {
c.mx.Lock()
defer c.mx.Unlock()

var err error
c.closeOnce.Do(func() {
err1 := c.Conn.WriteControl(
Expand Down