xiaonanln / goworld

Scalable Distributed Game Server Engine with Hot Swapping in Golang
Apache License 2.0
2.53k stars 450 forks source link

Code bug? #77

Closed github-yxb closed 4 years ago

github-yxb commented 4 years ago
// Choose a dispatcher client for sending Anywhere packets
func (service *DispatcherService) chooseGameForBootEntity() *gameDispatchInfo {

    if len(service.bootGames) > 0 {
        gameid := service.bootGames[service.chooseGameIdx%len(service.bootGames)]
        service.chooseGameIdx += 1
        return service.games[gameid]
    } else {
        gwlog.Errorf("%s chooseGameForBootEntity: no game", service)
        return nil
    }
    gameid := service.bootGames[rand.Intn(len(service.bootGames))]
    gdi := service.games[gameid]
    return gdi
}
xiaonanln commented 4 years ago

具体什么bug? Nan Lin +86 13656630312 邮箱:xiaonanln@gmail.com 签名由 网易邮箱大师 定制 On 11/21/2019 11:23, github-yxb wrote: // Choose a dispatcher client for sending Anywhere packets func (service *DispatcherService) chooseGameForBootEntity() *gameDispatchInfo { if len(service.bootGames) > 0 { gameid := service.bootGames[service.chooseGameIdx%len(service.bootGames)] service.chooseGameIdx += 1 return service.games[gameid] } else { gwlog.Errorf("%s chooseGameForBootEntity: no game", service) return nil } gameid := service.bootGames[rand.Intn(len(service.bootGames))] gdi := service.games[gameid] return gdi } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

github-yxb commented 4 years ago
        gameid := service.bootGames[rand.Intn(len(service.bootGames))]
    gdi := service.games[gameid]
    return gdi

最后的三行代码好像不会执行

simonlingoogle commented 4 years ago

是的,应该是忘了删了,你能提个PR吗修复 一下吗?