refactor: 将端口和在线ID类型从uint16改为uint32
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package cool
|
||||
|
||||
// 存值示例
|
||||
func AddClient(id uint16, client *ClientHandler) {
|
||||
func AddClient(id uint32, client *ClientHandler) {
|
||||
// 普通map:Clientmap[id] = client
|
||||
Clientmap.Store(id, client) // sync.Map存值
|
||||
}
|
||||
|
||||
// 取值示例
|
||||
func GetClient(id uint16) (*ClientHandler, bool) {
|
||||
func GetClient(id uint32) (*ClientHandler, bool) {
|
||||
// 普通map:client, ok := Clientmap[id]
|
||||
val, ok := Clientmap.Load(id) // sync.Map取值
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user