mirror of
https://github.com/statbate/fantastic-engine.git
synced 2026-08-11 03:02:41 +00:00
update
This commit is contained in:
parent
a8342b4f3c
commit
029cb6c989
1 changed files with 25 additions and 2 deletions
|
|
@ -73,6 +73,7 @@ func reconnectRoom(workerData Info) {
|
||||||
startRoom(workerData)
|
startRoom(workerData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func getMessageID(s string) int {
|
func getMessageID(s string) int {
|
||||||
i := strings.IndexByte(s, ',')
|
i := strings.IndexByte(s, ',')
|
||||||
if i != -1 {
|
if i != -1 {
|
||||||
|
|
@ -92,6 +93,22 @@ func getMessageData(s string) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func getRoomOnline(s string) int {
|
||||||
|
if len(s) > 4 {
|
||||||
|
x := s[1 : len(s)-1]
|
||||||
|
a := strings.IndexByte(x, '[')
|
||||||
|
b := strings.LastIndexByte(x, ']')
|
||||||
|
if a != -1 && b != -1 {
|
||||||
|
if v, err := strconv.Atoi(x[a+1 : b]); err == nil {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func getWS(workerData Info, key []byte) string {
|
func getWS(workerData Info, key []byte) string {
|
||||||
Dialer := *websocket.DefaultDialer
|
Dialer := *websocket.DefaultDialer
|
||||||
if _, ok := conf.Proxy[workerData.Proxy]; ok {
|
if _, ok := conf.Proxy[workerData.Proxy]; ok {
|
||||||
|
|
@ -248,7 +265,13 @@ func xWorker(workerData Info) {
|
||||||
messageID := getMessageID(string(message))
|
messageID := getMessageID(string(message))
|
||||||
|
|
||||||
if messageID == 28 && strings.Contains(string(message), "offline") {
|
if messageID == 28 && strings.Contains(string(message), "offline") {
|
||||||
fmt.Println("offline:", workerData.room)
|
fmt.Println("offline exit:", workerData.room)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//[39,{},1,[51]]
|
||||||
|
if messageID == 39 && getRoomOnline(string(message)) < 10 {
|
||||||
|
fmt.Println("few users exit:", workerData.room)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue