Skip to content

Commit dc87e87

Browse files
committed
myonce移到依赖包中
1 parent 8b78fa3 commit dc87e87

File tree

4 files changed

+5
-37
lines changed

4 files changed

+5
-37
lines changed

conn_unix.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/antlabs/wsutil/bytespool"
3232
"github.com/antlabs/wsutil/deflate"
3333
"github.com/antlabs/wsutil/enum"
34+
"github.com/antlabs/wsutil/myonce"
3435
"golang.org/x/sys/unix"
3536
)
3637

@@ -79,8 +80,8 @@ type Conn struct {
7980
// 也可以共用mu,区别 优点:节约内存,缺点:容易出现死锁和需要精心调试代码
8081
// 这里选择维护简单
8182
mu2 sync.Mutex
82-
onCloseOnce myOnce // 保证只调用一次OnClose函数
83-
closed int32 // 是否关闭
83+
onCloseOnce myonce.MyOnce // 保证只调用一次OnClose函数
84+
closed int32 // 是否关闭
8485
}
8586

8687
func newConn(fd int64, client bool, conf *Config) *Conn {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/antlabs/greatws
33
go 1.21
44

55
require (
6-
github.com/antlabs/wsutil v0.1.9
6+
github.com/antlabs/wsutil v0.1.10
77
golang.org/x/sys v0.12.0
88
)
99

once.go

Lines changed: 0 additions & 33 deletions
This file was deleted.

status_codes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (s StatusCode) String() string {
6767
return "ServerTerminating"
6868
}
6969

70-
return "unkown"
70+
return "unknown"
7171
}
7272

7373
type CloseErrMsg struct {

0 commit comments

Comments
 (0)