Giter VIP home page Giter VIP logo

th-bingo's Introduction

GitHub User's stars GitHub followers

About ✨ 关于

  • Good at several languages for server development
    擅长多种服务器开发语言

  • Know a little about web development
    略懂一些Web开发语言

  • Founder of the largest Danmaku Shooting Game QQ group, Touhou Project Freshman Camp
    最大的弹幕射击游戏QQ群——东方Project沙包聚集地的创始人

  • Founder of Hollow Knight speedrun community in China
    国内空洞骑士速通社区奠基人

  • The designer of settlement rules of the board game, Feng Sheng
    风声桌游结算规则的设计者

Site 📫 链接

Bilibili

th-bingo's People

Contributors

cutereimu avatar death-alter avatar dependabot[bot] avatar linxunan1437 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

th-bingo's Issues

(偶现)Connection timed out

展开查看相关日志
WARN io.netty.channel.DefaultChannelPipeline.onUnhandledInboundException(DefaultChannelPipeline.java:1152) An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection timed out
        at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
        at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:47)
        at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:284)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:259)
        at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:417)
        at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)
WARN io.netty.channel.DefaultChannelPipeline.onUnhandledInboundException(DefaultChannelPipeline.java:1152) An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection timed out
        at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
        at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:47)
        at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:284)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:259)
        at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:417)
        at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)
DEBUG org.tfcc.bingo.network.WebSocketServerChannelHandler.channelInactive(WebSocketServerChannelHandler.kt:32) 客户端断开连接:[id: 0xxxxxxxxx, L:/127.0.0.1:9999 ! R:/127.0.0.1:24174]
DEBUG org.tfcc.bingo.network.WebSocketServerChannelHandler.channelInactive(WebSocketServerChannelHandler.kt:32) 客户端断开连接:[id: 0xxxxxxxxx, L:/127.0.0.1:9999 ! R:/127.0.0.1:23982]

已经运行了一段时间的游戏,当卡池新增符卡后,写log.xlsx会因为找不到这张卡报错

报错信息:

14:30:49.024 ERROR org.tfcc.bingo.SpellLog.logRandSpells(SpellLog.kt:31) log rand spells failed:
java.lang.NullPointerException
        at org.tfcc.bingo.SpellLog.logSpell(SpellLog.kt:117)
        at org.tfcc.bingo.SpellLog.logSpell$default(SpellLog.kt:87)
        at org.tfcc.bingo.SpellLog.logRandSpells(SpellLog.kt:28)
        at org.tfcc.bingo.message.StartGameCs.handle(StartGameCs.kt:49)
        at org.tfcc.bingo.message.Dispatcher.handle$lambda$0(Dispatcher.kt:96)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

相关代码:

logList[gameType][card.name] = logList[gameType][card.name]!!.getCard(time - it.start)
}
timeLogs.remove(token)
} else {
logList[gameType][card.name] = logList[gameType][card.name]!!.getCard()
}
}
}
logList[gameType][card.name]!!.changed = true
}

每次md5返回的结果不一样

private fun md5sum(fileName: String): String? {
if (isWindows) return null
val p = Runtime.getRuntime().exec(arrayOf("md5sum", fileName))
if (!p.waitFor(1, TimeUnit.SECONDS)) {
logger.error("shell execute failed: md5sum $fileName")
return null
}
p.inputStream.use { `is` ->
BufferedReader(InputStreamReader(`is`)).use {
val md5 = it.readLine()
logger.debug(md5)
return md5
}
}
}

StopGame的时候,符卡记录的逻辑报错

17:17:24.764 ERROR org.tfcc.bingo.SpellLog.saveFile(SpellLog.kt:85) save file failed:
java.lang.NullPointerException: Cannot invoke "org.apache.poi.xssf.usermodel.XSSFRow.getCell(int)" because "$this$saveFile_u24lambda_u241_u24lambda_u240" is null
        at org.tfcc.bingo.SpellLog.saveFile(SpellLog.kt:70)
        at org.tfcc.bingo.message.StopGameCs.handle(StopGameCs.kt:38)
        at org.tfcc.bingo.message.Dispatcher.handle$lambda$0(Dispatcher.kt:96)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

新增统计功能

统计某张符卡的:

  • 出现次数
  • 选择次数
  • 收取次数
  • 从选择到收取所用的平均时间

记符卡Log的代码问题

这个 SpellLog.logSpellOperate 应该放在下面的判断后面

} else {
SpellLog.logSpellOperate(status, room.spells!![idx], token, gameType = SpellLog.GameType.NORMAL)
}
return when (token) {
room.host ->
status
room.players[0] -> {
if (room.host.isNotEmpty()) {
if (status.isRightStatus() || st == LEFT_GET && status != LEFT_GET)
throw HandlerException("权限不足")
if (st == RIGHT_GET)
throw HandlerException("对方已打完")
}

(偶现)缓存中出现没有token的玩家

在清除过期缓存时,有时会出现没有token的玩家。如下代码,其中的${player.token}为空字符串:

val players = File("cache").listFiles { _, name -> name.startsWith("player-") && name.endsWith(".0") }
if (players != null) {
for (f in players) {
val name = f.name
val player = getPlayer(name.substring("player-".length, name.length - ".0".length)) ?: continue
if (now >= player.lastOperateMs + 6 * 60 * 60 * 1000) {
logger.info("玩家 ${player.token} 过期, 自动清除")
removePlayer(player.token)
}
}
}

相关日志:

DEBUG org.tfcc.bingo.Store.clean(Store.kt:29) 开始清除过期缓存
INFO org.tfcc.bingo.Store.clean(Store.kt:37) 玩家 61dfaa0798855a0593b1fbbb210bd2c7 过期, 自动清除
INFO org.tfcc.bingo.Store.clean(Store.kt:37) 玩家 9db500f2eb3f51dfdab607f18fbcd2e4 过期, 自动清除
INFO org.tfcc.bingo.Store.clean(Store.kt:37) 玩家  过期, 自动清除
INFO org.tfcc.bingo.Store.clean(Store.kt:37) 玩家 0d549adc62c1dd52b5084e764d7a59ef 过期, 自动清除

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.