|
|
@ -27,6 +27,7 @@ type StarNotifyC struct {
|
|
|
|
// UseChannel 是否使用channel作为信息传递
|
|
|
|
// UseChannel 是否使用channel作为信息传递
|
|
|
|
UseChannel bool
|
|
|
|
UseChannel bool
|
|
|
|
isUDP bool
|
|
|
|
isUDP bool
|
|
|
|
|
|
|
|
Sync bool
|
|
|
|
// Queue 是用来处理收发信息的简单消息队列
|
|
|
|
// Queue 是用来处理收发信息的简单消息队列
|
|
|
|
Queue *starnet.StarQueue
|
|
|
|
Queue *starnet.StarQueue
|
|
|
|
// Online 当前链接是否处于活跃状态
|
|
|
|
// Online 当前链接是否处于活跃状态
|
|
|
@ -281,12 +282,20 @@ func (star *StarNotifyC) cnotify() {
|
|
|
|
mode, key, value := strs[0], strs[1], strs[2]
|
|
|
|
mode, key, value := strs[0], strs[1], strs[2]
|
|
|
|
if mode[0:2] != "cr" {
|
|
|
|
if mode[0:2] != "cr" {
|
|
|
|
if msg, ok := star.FuncLists[key]; ok {
|
|
|
|
if msg, ok := star.FuncLists[key]; ok {
|
|
|
|
|
|
|
|
if star.Sync {
|
|
|
|
|
|
|
|
msg(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
go msg(CMsg{key, value, mode, nil})
|
|
|
|
go msg(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if star.defaultFunc != nil {
|
|
|
|
if star.defaultFunc != nil {
|
|
|
|
|
|
|
|
if star.Sync {
|
|
|
|
|
|
|
|
star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
go star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
go star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if sa, ok := star.lockPool[mode]; ok {
|
|
|
|
if sa, ok := star.lockPool[mode]; ok {
|
|
|
|
sa.Key = key
|
|
|
|
sa.Key = key
|
|
|
@ -296,9 +305,16 @@ func (star *StarNotifyC) cnotify() {
|
|
|
|
sa.wait <- 1
|
|
|
|
sa.wait <- 1
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if msg, ok := star.FuncLists[key]; ok {
|
|
|
|
if msg, ok := star.FuncLists[key]; ok {
|
|
|
|
|
|
|
|
if star.Sync {
|
|
|
|
|
|
|
|
msg(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
go msg(CMsg{key, value, mode, nil})
|
|
|
|
go msg(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if star.defaultFunc != nil {
|
|
|
|
if star.defaultFunc != nil {
|
|
|
|
|
|
|
|
if star.Sync {
|
|
|
|
|
|
|
|
star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
go star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
go star.defaultFunc(CMsg{key, value, mode, nil})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -306,6 +322,7 @@ func (star *StarNotifyC) cnotify() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ClientStop 终止client端运行
|
|
|
|
// ClientStop 终止client端运行
|
|
|
|