Source file
test/fixedbugs/issue19555.go
1
2
3
4
5
6
7 package p
8
9 type NodeLink struct{}
10
11
12 type LinkRole int64
13
14 const (
15 LinkServer LinkRole = iota
16 LinkClient
17
18
19 linkNoRecvSend LinkRole = 1 << 16
20 linkFlagsMask LinkRole = (1<<32 - 1) << 16
21 )
22
23 func NewNodeLink(role LinkRole) *NodeLink {
24 var nextConnId uint32
25 switch role &^ linkFlagsMask {
26 case LinkServer:
27 nextConnId = 0
28 case LinkClient:
29 nextConnId = 1
30 default:
31 panic("invalid conn role")
32 }
33
34 _ = nextConnId
35 return nil
36 }
37
View as plain text