Archived
1
0
Fork 0

Fix a ConcurrentModificationException in PacketsAdapter.tick

This commit is contained in:
Moritz Ruth 2021-01-08 17:53:28 +01:00
parent 9aab2b1adc
commit 36ae79fe88
No known key found for this signature in database
GPG key ID: AFD57E23E753841B

View file

@ -22,8 +22,8 @@ import space.uranos.util.awaitSuspending
class PacketsAdapter(val session: UranosSession) { class PacketsAdapter(val session: UranosSession) {
private val packetsForNextTick = ArrayList<OutgoingPacket>() private val packetsForNextTick = ArrayList<OutgoingPacket>()
suspend fun tick() { suspend fun tick() = withContext(session.coroutineContext) {
packetsForNextTick.forEach { send(it) } // TODO: Fix ConcurrentModificationException packetsForNextTick.forEach { send(it) }
packetsForNextTick.clear() packetsForNextTick.clear()
} }